python 安裝模組報錯總結
1.安裝pandas模組報錯
然後檢視系統資訊,如下:
報錯資訊如下:
報錯資訊很明顯,說缺依賴包,然後用pip和easy_install安裝python-dev和python-devel都不成功,沒辦法,自己下載了一個python-devel-2.7.5-34.el7.x86_64.rpm安裝,
安裝命令:
安裝成功了。然後安裝pandas又報錯:
最後谷歌搜尋錯誤提示說應該是g++沒有安裝,然後搜尋g++:
安裝gcc-c++:yum install gcc-c++,成功後安裝pandas也就成功了。
如果最後還是不成功,則yum -y install mysql-devel libxml2 libxml2-dev libxslt* zlib gcc openssl
2.安裝MySQLdb模組報錯
如果有如下報錯:EnvironmentError: mysql_config not found
需要apt-get install libmysqlclient-dev && updatedb && locate mysql_config(ubuntu系統),如果是centos系統請執行yum install mysql-devel
如果還有報錯:_mysql.c:29:20: fatal error: Python.h: No such file or directory error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
需要apt-get install python-dev(ubuntu系統),如果是centos,如果不清楚到底缺什麼包就把下面的都安裝一遍:
yum install gcc-c++ python-devel mysql-devel zlib-devel openssl-devel
通過上述兩步,基本就安裝MySQLdb成功了。
3.安裝ipython報錯:unable to execute gcc: No such file or directory error: command 'gcc' failed with exit status 1
解決方法:yum install gcc
如果是如下報錯:fatal error: Python.h: No such file or directory error: command 'gcc' failed with exit status 1
解決方法:yum install python-devel(centos),如果是ubuntu,apt-get install python-dev