系統: CentOS-6.4-x86_64
Python : Python 3.4.5 和 Python 3.5.2
安裝 MySQL-python ,結果出錯:
ImportError: No module named 'ConfigParser'
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ry1be27_/mysql-python/
原因:
在 Python 3.x 版本后,ConfigParser.py 已經更名為 configparser.py 所以出錯!
可以看看系統中的 python 命令 ,系統自帶個 python 2.6。
[root@centos]# ls /usr/bin/python*
/usr/bin/python /usr/bin/python2 /usr/bin/python2.6
[root@centos]#
[root@centos]# python2.6 -V
Python 2.6.6
[root@centos]#
解決方法:
找到文件 configparser ,更名為舊版本的名稱 ConfigParser
cp /usr/local/Python34/lib/python3.4/configparser.py /usr/local/Python34/lib/python3.4/ConfigParser.py