• PIP: ImportError: No module named 'ConfigParser'


    louie-mac:~ louiezhou$ pip3 install  mysql-python
    DEPRECATION: Python 3.3 supported has been deprecated and support for it will be dropped in the future. Please upgrade your Python.
    Collecting mysql-python
      Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
        Complete output from command python setup.py egg_info:
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/private/var/folders/_r/fb0dg1jj4rd2yc21ybfkm9_h0000gn/T/pip-install-c5dukz/mysql-python/setup.py", line 13, in <module>
            from setup_posix import get_config
          File "./setup_posix.py", line 2, in <module>
            from ConfigParser import SafeConfigParser
        ImportError: No module named 'ConfigParser'
    
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/_r/fb0dg1jj4rd2yc21ybfkm9_h0000gn/T/pip-install-c5dukz/mysql-python/
    

    使用pip安装报错, 网上给出的解决方案是:

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

     

    或者:

    pip install -e git+git://github.com/theatlantic/django-mysqlndb-backend.git@v1.1.0#egg=django-mysqlndb-backend

     

    尝试后发现依然无法解决问题

    后来查了相关文档从python3 以后 pymysql取代MySQL-python

    因此 安装推荐使用PyMySql

    第一种:

    $ pip3 install PyMySQL
    

    第二种:

    $ git clone https://github.com/PyMySQL/PyMySQL
    $ cd PyMySQL/
    $ python3 setup.py install

    第三种:

    $ # X.X 为 PyMySQL 的版本号
    $ curl -L https://github.com/PyMySQL/PyMySQL/tarball/pymysql-X.X | tar xz
    $ cd PyMySQL*
    $ python3 setup.py install
    $ # 现在你可以删除 PyMySQL* 目录
  • 相关阅读:
    js将url转换二维码
    百度地图api使用
    js字符串转日期兼容性
    Object.keys的使用
    Web App和Native App的比较
    数组转为对象
    常用meta整理
    git merge和git rebase的区别
    GitHub 翻译之 'Hello-world' 翻译
    js数据类型
  • 原文地址:https://www.cnblogs.com/maybach/p/14481259.html
Copyright © 2020-2023  润新知