解決Python.h找不到問題


在linux系統上安裝python的MySQLdb庫時,提示

pip install MySQL _mysql.c:29:20: fatal error: Python.h: No such file or directory #include "Python.h" ^ compilation terminated. error: command 'gcc' failed with exit status 1
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
 
 

找不到Python.h,這是因為沒有安裝python-dev

 

使用yum search python |grep devel

找到了可用版本

python-devel.x86_64 : The libraries and header files needed for Python : development
  • 1.
  • 2.
 
 

 

執行

yum  install python-devel.x86_64
  • 1.
 
 

進行安裝

 

安裝成功之后,Python.h出現了

/usr/include/python2.7/Python.h
  • 1.
 
 

 

再安裝MySQL就成功了


免責聲明!

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



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