Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 419
Ruslan Avatar asked Jan 02 '15 21:01

Ruslan


People also ask

How do I install MySQL on Python 3?

The easiest way to probably install and use MySQL in Python is to open up your command prompt. Once the command prompt is opened, then specify the full path to the Scripts folder of the Python package. Once you have this full path specified to the Scripts folder, then type in, pip install pymysql.

Does Python 3.9 support MySQL?

@RocketHazmat yes, it worked as you said :) thank you! The support for Python 3.9 will be added in the upcoming Connector/Python 8.0.

How do I get MySQL in Python?

Type “ pip install pymysql ” (without quotes) in the command line and hit Enter again. This installs pymysql for your default Python installation.


2 Answers

Resolved:

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

Edit settings.py

'ENGINE': 'mysql.connector.django',
like image 180
Ruslan Avatar answered Nov 03 '22 00:11

Ruslan


MySQL-python 1.2.5 does not support Python 3. The Django 1.7 docs recommend the fork mysqlclient.

like image 22
Alasdair Avatar answered Nov 03 '22 02:11

Alasdair