web-dev-qa-db-ja.com

Python3.4は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
9
Ruslan

解決済み:

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

Settings.pyを編集します

'ENGINE': 'mysql.connector.Django',
7
Ruslan

MySQL-python 1.2.5 はサポートしていませんPython 3. Django 1.7 docs フォークをお勧めします mysqlclient

19
Alasdair

Centosの場合:yum install mysql-devel pip3 install mysqlclient

0
kulssaka