ubuntu下python安装pandas和numpy等依赖库版本不兼容的问题RuntimeWarning: numpy.dtype size changed

习惯了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 了。

 

经验教训:

    小白真辛苦,望此文能指路。

相关文章
相关标签/搜索