开发者

Installing MySQL for python/Django

I'm trying to use MySQL with django and right now the following isn't开发者_如何学Python 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.


The answer was to edit the site.cfg file so that it points to the mysql_config file in the /usr/local/mysql dir

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜