美文网首页
MySQL-python>=1.2.5 安装不成功解决方法

MySQL-python>=1.2.5 安装不成功解决方法

作者: LizPL | 来源:发表于2017-06-26 17:47 被阅读0次

    pip install MySQL-python

    报错:

    Using cached MySQL-python-1.2.5.zip

    Complete output from command python setup.py egg_info:

    sh: mysql_config: command not found

    Traceback (most recent call last):

    File "", line 1, in

    File "/tmp/pip-build-tgOYUV/MySQL-python/setup.py", line 17, in

    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

    参考:http://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found

    需要执行:yum install python-devel mysql-devel

    然而执行yum命令出现新的报错:

    http://10.10.10.55/centos/os/6/x86_64/repodata/repomd.xml: [Errno 12] Timeout onhttp://10.10.10.55/centos/os/6/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')

    Trying other mirror.

    Error: Cannot retrieve repository metadata (repomd.xml) for repository: local_repo. Please verify its path and try again

    参考:http://unix.stackexchange.com/questions/109585/yum-update-fails-error-cannot-retrieve-repository-metadata-repomd-xml-for-re

    得到启发:

    修改了如下文件:

    vim /etc/yum.repos.d/local.repo

    baseurl=http://mirror.centos.org/centos/6/os/x86_64/

    将原来访问超时的镜像修改为了本地可以访问的镜像地址。

    然后执行了

    yum install python-devel mysql-devel

    然后再:

    pip install MySQL-python

    安装成功!

    相关文章

      网友评论

          本文标题:MySQL-python>=1.2.5 安装不成功解决方法

          本文链接:https://www.haomeiwen.com/subject/zzejcxtx.html