pip install MySQL-python 失敗


1. EnvironmentError: mysql_config not found
原因:/usr/bin/mysql_config沒有次文件,要安裝libmysqlclient-dev, apt install libmysqlclient-dev -y 如果能安裝上並且有了mysql_config此問題就可以解決了。如果libmysqlclient-dev 沒有安裝成功,提示:E: Unable to correct problems, you have held broken packages 先參考http://www.cnblogs.com/aaron-agu/p/8862624.html 安裝好libmysqlclient-dev

2.  _mysql.c:29:20: fatal error: Python.h: No such file or directory
   #include "Python.h"
                      ^
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
原因:python-dev 沒有安裝,如果apt-get install python-dev -y 可以成功安裝,此問題解決,如果提示如下錯誤 python-dev : Depends: python (= 2.7.11-1) but 2.7.12-1~16.04 is to be installed
              Depends: libpython-dev (= 2.7.11-1) but it is not going to be installed
              Depends: python2.7-dev (>= 2.7.11-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages
此錯誤原因 python版本過高,aptitude install python-dev 類似http://www.cnblogs.com/aaron-agu/p/8862624.html的解決方案,降級。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM