Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3 ImportError: No module named 'ConfigParser'

I am trying to pip install the MySQL-python package, but I get an ImportError.

Jans-MacBook-Pro:~ jan$ /Library/Frameworks/Python.framework/Versions/3.3/bin/pip-3.3 install MySQL-python Downloading/unpacking MySQL-python   Running setup.py egg_info for package MySQL-python     Traceback (most recent call last):       File "<string>", line 16, in <module>       File "/var/folders/lf/myf7bjr57_jg7_5c4014bh640000gn/T/pip-build/MySQL-python/setup.py", line 14, 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'     Complete output from command python setup.py egg_info:     Traceback (most recent call last):    File "<string>", line 16, in <module>    File "/var/folders/lf/myf7bjr57_jg7_5c4014bh640000gn/T/pip-build/MySQL-python/setup.py", line 14, 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 /var/folders/lf/myf7bjr57_jg7_5c4014bh640000gn/T/pip-build/MySQL-python Storing complete log in /Users/jan/.pip/pip.log Jans-MacBook-Pro:~ jan$  

Any ideas?

like image 709
if __name__ is None Avatar asked Dec 30 '12 01:12

if __name__ is None


People also ask

How do I know if Configparser is installed?

Check configparser Version Windows To check which version of configparser is installed, use pip show configparser or pip3 show configparser in your Windows CMD, command line, or PowerShell.

What is Configparser Python?

The configparser module from Python's standard library defines functionality for reading and writing configuration files as used by Microsoft Windows OS. Such files usually have . INI extension. The INI file consists of sections, each led by a [section] header.


1 Answers

You can instead use the mysqlclient package as a drop-in replacement for MySQL-python. It is a fork of MySQL-python with added support for Python 3.

I had luck with simply

pip install mysqlclient 

in my python3.4 virtualenv after

sudo apt-get install python3-dev libmysqlclient-dev 

which is obviously specific to ubuntu/debian, but I just wanted to share my success :)

like image 124
Eldamir Avatar answered Sep 20 '22 04:09

Eldamir