習慣了linux下用pip install numpy及pip install pandas命令了。折騰了很久了。html
上來先在python3中pip3 install numpy裝了numpy,而後再pip3 install pandas就卡住不動了,或者報什麼錯,而後把numpy卸載了,繼續裝pandas仍是卡住了,好像是找不到相應版本的依賴庫。python
那就轉裝python2.7吧,繼續pip install pandas,裝好了,在pycharm中和命令行交互中導入運行時分別報以下錯誤:linux
pycharm下的錯誤:python2.7
RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88……ui
命令行下錯誤:spa
ImportError: C extension: No module named missing not built. If you want to import pandas from the source directory, you may need to run 'python命令行
3. 那就下載源碼、whl文件試試吧,分別用python2和python3安裝,python2能夠編源碼並安裝,只是問題同樣,安裝whl則報版本不能安裝;python3同樣的卡住、安裝whl不能裝。1. 首先想到的固然是百度或谷歌一下,幾乎沒搜到解決辦法。固然我也猜到了是版本不兼容了,因此卸載了numpy、pandas等庫,直接pip install pandas,由於發現會自動安裝numpy等依賴庫,裝好了發現仍是報同樣的問題,繼續全刪了按照網上的教程來一個個依賴庫先裝繼續裝pandas,同樣。
2. 難道是pip版本不夠?升級下,python -m pip install -U pip。(引用:https://www.cnblogs.com/zhanglin123/p/8526748.html),仍是不行。htm
4. 走投無路了,搜如何查看pandas的依賴庫,無果。還試了在虛擬機下安裝等手段,或下降版本安裝 pip install pandas==0.21.1(最新是0.23.1)。怎麼就安裝不到合適版本的numpy呢!blog
5. 無心中,不卸載pandas的時候,執行 pip install pandas,終於出了有用信息教程
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: pandas in /usr/local/lib/python2.7/dist-packages (0.21.1)
Requirement already satisfied: pytz>=2011k in /usr/local/lib/python2.7/dist-packages (from pandas) (2018.5)
Requirement already satisfied: python-dateutil in /usr/local/lib/python2.7/dist-packages (from pandas) (2.7.3)
Requirement already satisfied: numpy>=1.9.0 in /usr/local/lib/python2.7/dist-packages (from pandas) (1.15.0)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python2.7/dist-packages/six-1.10.0-py2.7.egg (from python-dateutil->pandas) (1.10.0)
原來這裏要求的numpy得是1.9.0之後的版本,而不管是直接裝numpy仍是經過安裝pandas裝依賴庫都只能裝1.15.0的版本,原來pip安裝庫時並不能尋找到依賴的合適版本,只是執行同樣的安裝命令而已。
真像大白, pip install numpy==1.9.0安裝指定版本,搞定,終於能夠正常導入了。
也能夠安裝 pip install Scikit-learn 了。
經驗教訓:
小白真辛苦,望此文能指路。