Python 3 ImportError: No module named 'ConfigParser'

前端 未结 18 2620
半阙折子戏
半阙折子戏 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:19

    Here is a code that should work in both Python 2.x and 3.x

    Obviously you will need the six module, but it's almost impossible to write modules that work in both versions without six.

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

提交回复
热议问题