简体   繁体   中英

Installing MySQL for python/Django

I'm trying to use MySQL with django and right now the following isn't executing properly:

python manage.py syncdb

I also downloaded the Mysql-python interpreter and ran the following lines but still an error:

python setup.py build
sudo python setup.py install


Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "/Users/user/Downloads/MySQL-python-1.2.3/setup_posix.py", line 49, in get_config
    libs = mysql_config("libs")
  File "/Users/user/Downloads/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: /usr/local/bin/mysql_config not found

I think it's having trouble finding mysql_config , is there a way that I can point the setup to the file? Right now my setup.py is in ~/Downloads and mysql is in /usr/local/mysql/bin

It seems you may not have any of the MySQL client applications installed. If you are using Linux (and this varies from distribution to distribution), the package you will need to install on Ubuntu is "mysql-client".

From the path you show, I'm guessing you are running on Mac OS X (you really need to state what platform you are using and what version of Python you are running). However, if you are on Mac OS X, your best bet by far is to use a complete solution of installing compatible versions of Python, MySQL client libraries, MySQLdb, and Django by using one of the third-party open source package managers on OS X: MacPorts, homebrew, Fink, or others.

See, for example, the answer here .

答案是编辑site.cfg文件,使其指向/ usr / local / mysql目录中的mysql_config文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM