No module named 'ConfigParser'


系统: 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。

[plain] view plain copy
  1. [root@centos]# ls /usr/bin/python*  
  2. /usr/bin/python  /usr/bin/python2  /usr/bin/python2.6  
  3. [root@centos]#  
  4. [root@centos]# python2.6 -V  
  5. Python 2.6.6  
  6. [root@centos]#  



解决方法:

找到文件 configparser ,更名为旧版本的名称 ConfigParser

[plain] view plain copy
  1. cp /usr/local/Python34/lib/python3.4/configparser.py /usr/local/Python34/lib/python3.4/ConfigParser.py 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM