我试图将MySQLdb设置为与Scthon一起用于Scrapy。我使用以下步骤:
安装PIP:
sudo easy_install pip
编辑〜/ .profile:
nano ~/.profile
复制并粘贴以下两行
export PATH=/usr/local/mysql/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
保存并退出。后记执行以下命令
source ~/.profile
安装MySQLdb
sudo pip install MySQL-python
完成最后一步后,我收到以下错误:
usf-gold-wifi-226-5-42:documents soufin_r$ sudo pip install MySQL-python
Downloading/unpacking MySQL-python
Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
Running setup.py (path:/private/tmp/pip_build_root/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 "/private/tmp/pip_build_root/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 "/private/tmp/pip_build_root/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 /private/tmp/pip_build_root/MySQL-python
Storing debug log for failure in /Users/soufin_r/Library/Logs/pip.log
usf-gold-wifi-226-5-42:documents soufin_r$
答案 0 :(得分:0)
EnvironmentError: mysql_config not found
首先安装MySQL客户端工具和开发文件。