mysql_config not found

在macbook环境下,安装python-mysql时会遇到一个错误:

192:~ Rico$ 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


遇到上述错误,首先检查两点:

1.有没有安装mysql

    如果没有安装mysql,请先安装mysql。

2.mysql的环境变量配置

    如果安装了mysql,讲mysql的bin目录添加到PATH环境变量中,且将mysql lib目录路径添加到DYLD_LIBRARY_PATH变量中。

    export MYSQL_HOME="实际环境中的mysql跟目录"

    export PATH=$MYSQL_HOME/bin:$PATH

    export DYLD_LIBRARY_PATH=$MYSQL_HOME/lib:$DYLD_LIBRARY_PATH

经过以上1和2步的操作,应该没问题了,就可以进行安装

    sudo pip install MySQL-python


阅读更多
文章标签: mysql_config not fou
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭