首页 > 代码库 > ImportError: No module named 'ConfigParser'

ImportError: No module named 'ConfigParser'

Resolve Method:

I found the problem. I had manually installed a newer version of python (version 3.2 but the version installed through packages is 2.7) and I just redirected /usr/bin/python to python3.2. Apparently in 3.2 some syntax used in /usr/bin/pyclean is not valid anymore. Restoring the original link of /usr/bin/python to /usr/bin/python2 solved the problem. Now the scripts could be run without any issues.

the link: StackOverflow


依照这想法,我顺利攻克了这个问题。

我的系统是ubuntu 14.04,安装了python2.7

看到这里后,安装了python3,并按顺序运行下面命令

# 改动python为python2

rm /usr/bin/python

ln -s /usr/bin/python2 /usr/bin/python

# 删除python-configparser。再通过aptitude来安装

sudo apt-get purge --auto-remove python-configparser

sudo aptitude install python-configparser

ImportError: No module named 'ConfigParser'