Python 3 ImportError: No module named 'ConfigParser'

前端 未结 18 2300
半阙折子戏
半阙折子戏 2020-11-22 12:52

I am trying to pip install the MySQL-python package, but I get an ImportError.

Jans-MacBook-Pro:~ jan$ /Library/Framew         


        
相关标签:
18条回答
  • 2020-11-22 13:21
    pip install configparser
    sudo cp /usr/lib/python3.6/configparser.py /usr/lib/python3.6/ConfigParser.py
    

    Then try to install the MYSQL-python again. That Worked for me

    0 讨论(0)
  • 2020-11-22 13:21

    how about checking the version of Python you are using first.

    import six
    if six.PY2:
        import ConfigParser as configparser
    else:
        import configparser
    
    0 讨论(0)
  • 2020-11-22 13:24

    I got further with Valeres answer:

    pip install configparser sudo cp /usr/lib/python3.6/configparser.py /usr/lib/python3.6/ConfigParser.py Then try to install the MYSQL-python again. That Worked for me

    I would suggest to link the file instead of copy it. It is save to update. I linked the file to /usr/lib/python3/ directory.

    0 讨论(0)
  • 2020-11-22 13:26

    This worked for me

    cp /usr/local/lib/python3.5/configparser.py /usr/local/lib/python3.5/ConfigParser.py
    
    0 讨论(0)
  • 2020-11-22 13:29

    Do pip3 install PyMySQL and then pip3 install mysqlclient. Worked for me

    0 讨论(0)
  • 2020-11-22 13:29

    I still have this issue, so I go to /usr/lib/python3.8 and type as sudoer:

    cp configparser.py ConfigParser.py
    

    You may have another python version than 3.8.

    0 讨论(0)
提交回复
热议问题