添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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
                    pi@raspberrypi:/ $ sudo apt-get install mysqlclient Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package mysqlclient
    – David Morin
                    Nov 22, 2019 at 15:41
    

    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.

    For future reference apt search mysql | grep python might have saved you time guessing at package names here. – goldilocks Nov 22, 2019 at 16:36

    Thanks for contributing an answer to Raspberry Pi Stack Exchange!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.