美文网首页
ubuntu中 mysql-python安装时Environm

ubuntu中 mysql-python安装时Environm

作者: 字节码 | 来源:发表于2017-12-31 19:51 被阅读94次
  • 在ubuntu虚拟环境下执行pip install mysql-python安装mysql-python时报错:
(blog) parallels@ubuntu:~/Desktop$ pip install mysql-python
Collecting mysql-python
  Using cached MySQL-python-1.2.5.zip
    Complete output from command python setup.py egg_info:
    sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-Sg0DgT/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
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Sg0DgT/mysql-python/

  • 解决方法:
    安装libmysqlclient
    sudo apt-get install libmysqlclient-dev
    找到mysql_config文件的路径
    sudo updatedb
    locate mysql_config
    然后再执行安装mysql即可:
    pip install mysql-python
    mysql_config的位置为:/usr/bin/mysql_config

相关文章

网友评论

      本文标题:ubuntu中 mysql-python安装时Environm

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