MYSQL- python pip install error
MySQL-python
MySQL-3.23 through 5.5 and Python-2.4 through 2.7 are currently supported. Python-3.0 will be supported in a future release.
You can install mysqlclient or pymysql,I prefer the latter:
pip install pymysql
And add this to your manage.py
:
import pymysql
pymysql.install_as_MySQLdb()
Did you install the SQL client dev pacakge on your system?
sudo apt install libmysqlclient-dev
if you are using mariadb, the drop in replacement for mysql, then run
sudo apt install libmariadbclient-dev
then try again
pip install mysql-connector
Installations of mysql
in some environments can place binaries in directory relative to environment. pip
installation fails because setup.py
does not find mysql_config
at expected path. Steps for source installation -
- Download files here Edit
mysql_config
path mentioned inMySQL-python-1.2.5/site.cfg
with correct path on your local environment. For example,
mysql_config = /usr/local/mysql/bin/mysql_config
- Run below commands inside directory
MySQL-python-1.2.5
-
$ python setup.py build
$ sudo python setup.py install