Reputation: 63
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.
Upvotes: 2
Views: 3801
Reputation: 114
macos: If you do not use brew you can install mysql from the installer: https://dev.mysql.com/downloads/mysql/
Upvotes: -1
Reputation: 1
I had a similar situation. You can try:
Upvotes: 0
Reputation: 141
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.
Upvotes: 1
Reputation: 1688
try doing
sudo apt-get install build-essential python-dev libmysqlclient-dev
later
sudo apt-get install python-mysqldb
Upvotes: 2