2

I've been trying to install mysql for hours now, I've gone through so many forums and everything can someone help me. Every time I run the command pip install mysql-python I get


(DjangoProject-env)Adams-MacBook-Air:DjangoProject AdamC$ pip install mysql-python
 Downloading/unpacking mysql-python
   Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
   Running setup.py (path:/Users/AdamC/projects/Environment/DjangoProject-env/build/mysql-        python/setup.py) egg_info for package mysql-python
     sh: mysql_config: command not found
     Traceback (most recent call last):
      File "<string>", line 17, in <module>
       File "/Users/AdamC/projects/Environment/DjangoProject-env/build/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
      Complete output from command python setup.py egg_info:
       sh: mysql_config: command not found

 Traceback (most recent call last):

   File "<string>", line 17, in <module>

   File "/Users/AdamC/projects/Environment/DjangoProject-env/build/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

   Cleaning up...
   Command python setup.py egg_info failed with error code 1 in   /Users/AdamC/projects/Environment/DjangoProject-env/build/mysql-python
  Storing debug log for failure in /Users/AdamC/.pip/pip.log 
  (DjangoProject-env)Adams-MacBook-Air:DjangoPoject AdamC$ 

I've tried sourcing a .profile

 export PATH=/usr/local/mysql/bin:$PATH
 export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

And a few other things but I can't remember right now, any help would be greatly appreciated.

3
  • 1
    This does not install MySQL itself, it only installs MySQL DB adapter for Python. You first need to install MySQL (can't help you here, as I don't use OSX), or, if you already have it in your system, you need to make it available for MySQL-Python. Commented Jul 10, 2014 at 6:09
  • Are you using the built-in system Python? Commented Jul 10, 2014 at 6:31
  • Yea I'm pretty sure its version 2.7.6 last time I check, if that helps. Commented Jul 13, 2014 at 1:29

4 Answers 4

2

try doing

sudo apt-get install build-essential python-dev libmysqlclient-dev

later

sudo apt-get install python-mysqldb
Sign up to request clarification or add additional context in comments.

Comments

1

I had this same error, but I'm not sure if it's from the same situation. I didn't originally have MySQL installed when I was trying to install mysql-python. It therefore couldn't use any MySQL commands like mysql-config.

If you don't have Mac Homebrew installed, go here to learn how to install it: http://brew.sh/

Then you can install MySQL with this command:

brew install mysql

And finally,

pip install mysql-python

should proceed to completion.

Comments

0

I had a similar situation. You can try:

  • Step1. Download the Postgres server at www.psequel.com
  • Step2. Select the Gui Application link and then select the PSequel.
  • Step3.Once everything has been downloaded, open your Postgres panel and then launch the terminal by clicking "open psql." This takes you to the terminal. Step4. You can now start using creating databases using MySQL.

Comments

-1

macos: If you do not use brew you can install mysql from the installer: https://dev.mysql.com/downloads/mysql/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.