I created virtualenv for django 1.9 project. I am trying to pip install mysqlclient or mysql-python but both of them gives me errors.
pip install mysqlclient
pip install mysql-python
both give me the same error message:
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/r4/bkv_4t9s4r140pjkgv6lsq8w0000gn/T/pip-build-cdxcssp9/mysqlclient
any suggestions!?
If a problem arises, pip will throw an error with a message like mysqliclient installation error. First, check that you are connected to the internet and it is stable. Try to run the command again. Next, you will have to manually download and install the package if the problem persists.
You can easily install the mysqlclient in python3.* virtual environment or at system level just follow these steps: Don't forget to update the python version as per your need, and for python2.7 use If you're installing the same at the system level then add sudo in the beginning of the command.
This is a database client application that serves as the medium/interface between the user running Python codes and the mysql database. mysqlclient was developed to replace MySql-python and provides support for Python3, although it is backward compatible as well.
This generally happens if you have multiple versions of python installed in your system. First, uninstall mysqlclient and pymysql globally (if installed): If using pycharm, it will popup for setting up an interpreter. Select python3.6 as your interpreter and create a virtual environment. If not using pycharm, This should work!
Try to run this before:
Ubuntu:
sudo apt-get install python-dev python3-dev
sudo apt-get install libmysqlclient-dev
pip install pymysql
pip install mysqlclient
In OSX:
sudo xcodebuild -license accept
brew install mysql-connector-c
This is probably due to your mysql_config
being broken.
As of 2019, here is how to run smoothly pip install mysqlclient
on MacOS:
brew info openssl
and follow the commands at the bottom
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
Other approaches:
brew install/upgrade/reinstall mysql
: did not fix the issue for me, but has the nice side effect to make sure your installation is clean.brew install mysql-connector-c
: to make that work you have to unlink mysql, which ruins your setup and it did not fix the issue for me.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With