0

I am following this guide: How do I connect to a MySQL Database in Python? running jupyter notebook.

I am running windws 10 operating system and I have installed MySQLdb from this link https://sourceforge.net/projects/mysql-python/files/ "MySQL for python"

I have MySQL Workbench installed.

When running I get an error

ImportErrorTraceback (most recent call last)
<ipython-input-5-a07af86e2020> in <module>()
---> 12 import MySQLdb

ImportError: No module named MySQLdb

I am not sure what I am doing wrong.

I tried things such as

pip install mysqlclient
pip install mysql-python

Running mysqlclient gives me following:

Collecting mysqlclient
  Using cached mysqlclient-1.3.10.tar.gz
    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-build-TH5iAY/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

Running mysql-python gives me following:

Collecting mysql-python
  Using cached 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-build-anTaSr/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

When looking up the error on stack, it tells me to install MySQLdb, but I have that installed already.

Community
  • 1
  • 1
aze45sq6d
  • 876
  • 3
  • 11
  • 26

0 Answers0