ubuntu pip安装MySQL-python报错mysql_config not found

错误:EnvironmentError: mysql_config not found
Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-uaIt6o/MySQL-python/

解决办法:

sudo apt-get install libmysqlclient-dev  
cd /usr/bin
sudo updatedb  
cd ~
pip install MySQL-python

在 pip 10.0.0版本中,最后一步会出现

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main

需要对 /usr/bin/pip 文件进行修改

vim /usr/bin/pip

from pip import main
if __name__ == '__main__':
    sys.exit(main())

改成

from pip import __main__
if __name__ == '__main__':
    sys.exit(__main__._main())

之后再

pip install MySQL-python

就可以了

你可能感兴趣的:(ubuntu)