簡體   English   中英

Python3.4無法安裝mysql-python

[英]Python3.4 can't install mysql-python

# pip3.4 install mysql-python
  Downloading/unpacking mysql-python
  Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
  Running setup.py (path:/tmp/pip_build_root/mysql-python/setup.py) egg_info for package mysql-python
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/mysql-python/setup.py", line 13, in <module>
        from setup_posix import get_config
      File "/tmp/pip_build_root/mysql-python/setup_posix.py", line 2, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/mysql-python/setup.py", line 13, in <module>

    from setup_posix import get_config

  File "/tmp/pip_build_root/mysql-python/setup_posix.py", line 2, in <module>

    from ConfigParser import SafeConfigParser

ImportError: No module named 'ConfigParser'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/mysql-python
Storing debug log for failure in /root/.pip/pip.log

MySQL-python 1.2.5不支持Python 3.Django 1.7文檔推薦使用fork mysqlclient

解決:

 pip3.4 install --allow-external mysql-connector-python 

編輯settings.py

'ENGINE': 'mysql.connector.django',

在Centos下:yum install mysql-devel pip3安裝mysqlclient

在Ubuntu或Debian上,只需要sudo apt-get install python-mysqldb。 它對我有用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM