I have tried a few different ways to get this installed. mysqlclient and also tried pip install MySQL-python both result in error.
pi@raspberrypi:/ $ pip install MySQL-python
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting MySQL-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-YvczBg/MySQL-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-YvczBg/MySQL-python/
pi@raspberrypi:/ $ pip install MySQLclient
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting MySQLclient
Downloading https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz (85kB)
100% |████████████████████████████████| 92kB 1.3MB/s
Complete output from command python setup.py egg_info:
sh: 1: mysql_config: not found
sh: 1: mariadb_config: not found
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-n01LjQ/MySQLclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "setup_posix.py", line 61, in get_config
libs = mysql_config("libs")
File "setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_mysql_config_path,))
EnvironmentError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-n01LjQ/MySQLclient/
pi@raspberrypi:/ $
Is something wrong with my install on rasbian buster?
This worked last week for 10 other Pis i have. But this week I cannot get anything to install. I tested my pip3 to see if it was a bad pip install but that works for other installs. for whatever reason I cannot get mysqlclients to install. Any ideas?
What I have tried
- I have uninstalled and reinstalled python 1,2,3
- I have reinstalled Buster I have pulled my hair out! lol
- I have also used pip3 install mysqlclient and same results.
- I have used sudo pip3 install but same results
I have also tried installing from rasbian repository
pi@raspberrypi:/ $ sudo apt-get install mysqlclient
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mysqlclient
pi@raspberrypi:/ $ sudo apt-get install MySQL-python
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package MySQL-python
-
Why are you not installing from the Raspbian repository with apt install?joan– joan2019年11月22日 15:27:55 +00:00Commented Nov 22, 2019 at 15:27
-
pi@raspberrypi:/ $ sudo apt-get install mysqlclient Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package mysqlclientDavid Morin– David Morin2019年11月22日 15:41:43 +00:00Commented Nov 22, 2019 at 15:41
-
it is not available via the rasbian repositoryDavid Morin– David Morin2019年11月22日 15:42:16 +00:00Commented Nov 22, 2019 at 15:42
-
The non-python MySQL stuff has been replaced with mariaSQL.goldilocks– goldilocks2019年11月22日 16:35:44 +00:00Commented Nov 22, 2019 at 16:35
1 Answer 1
After rethinking how this works I was able to install mysqldb with the following command.
sudo apt-get install python3-mysqldb
This works for my above script.
-
2For future reference
apt search mysql | grep python
might have saved you time guessing at package names here.goldilocks– goldilocks2019年11月22日 16:36:17 +00:00Commented Nov 22, 2019 at 16:36 -
1Another way to find packages on the repository:
apt list 'python*mysql*'
.Ingo– Ingo2019年11月22日 18:45:35 +00:00Commented Nov 22, 2019 at 18:45 -
Mark it as the best answer if it works, please.AnonyoZarif– AnonyoZarif2020年07月20日 15:35:06 +00:00Commented Jul 20, 2020 at 15:35
Explore related questions
See similar questions with these tags.