欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

python:ModuleNotFoundError:Nomodulenamed解决方法

程序员文章站 2022-07-07 23:42:27
问题: Complete output from command python setup.py egg_info: Traceback (most recent...

问题:

Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "", line 1, in 
      File "/tmp/pip-build-c_y6ttgr/MySQL-python/setup.py", line 13, in 
        from setup_posix import get_config
      File "/tmp/pip-build-c_y6ttgr/MySQL-python/setup_posix.py", line 2, in 
        from ConfigParser import SafeConfigParser
    ModuleNotFoundError: No module named 'ConfigParser'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-c_y6ttgr/MySQL-python/

解决:

方法一:
修改six模块为

try:
    import configparser
except:
    from six.moves import configparser 

方法二:

cp /usr/local/lib/python3.5/configparser.py /usr/local/lib/python3.5/ConfigParser.py