Python 3 ImportError: No module named ConfigParser
Python 3 ImportError: No module named ConfigParser
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 🙂
In Python 3, ConfigParser
has been renamed to configparser
for PEP 8 compliance. It looks like the package you are installing does not support Python 3.
Python 3 ImportError: No module named ConfigParser
Here is a code that should work in both Python 2.x and 3.x
Obviously you will need the six
module, but its almost impossible to write modules that work in both versions without six.
try:
import configparser
except:
from six.moves import configparser