【问题标题】:Getting error while trying to install MySQLdb on OS X尝试在 OS X 上安装 MySQLdb 时出错
【发布时间】:2014-09-19 01:50:06
【问题描述】:

我正在尝试将 MySQLdb 设置为与 python 一起用于 Scrapy。我正在使用以下步骤:

安装画中画:

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$ 

【问题讨论】:

标签: python mysql macos


【解决方案1】:
EnvironmentError: mysql_config not found

首先安装 MySQL 客户端工具和开发文件。

【讨论】:

  • 没有线索。我不运行 OS X。
猜你喜欢
  • 2018-05-16
  • 2017-09-17
  • 2011-07-28
  • 2015-10-30
  • 2014-11-19
  • 1970-01-01
  • 1970-01-01
  • 2013-05-05
  • 2016-07-22
相关资源
最近更新 更多