I have a following problem. I would like to install MySQLdb. I try pip install mysqlclient
but I got this error message:
Collecting mysqlclient
Using cached mysqlclient-2.1.1.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ydedt20p/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ydedt20p/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-ydedt20p/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-ydedt20p/mysqlclient/
Complete output (15 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-ydedt20p/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-ydedt20p/mysqlclient/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-ydedt20p/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I am using Python 3.8 on Ubuntu. How can I fix it, please?
CodePudding user response:
Please read and follow the installation instructions for Linux.
For Ubuntu,
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
to install the required libraries before attempting to
pip install mysqlclient