numpy.dtype size changed, may indicate binary incompatibility 问题解决方案

问题描述:

安装 pandas 模块, 一路顺畅...

E:\练习>pip install pandas
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pandas
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ea/97/67862524b27584defe768513be9e5de10110229bb748525ddac55a20124f/pandas-0.23.4-cp35-cp35m-win32.whl (6.6MB)
    100% |████████████████████████████████| 6.6MB 1.2MB/s
Collecting numpy>=1.9.0 (from pandas)
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/1b/f0/c90d0068665841f2a303480ae51c192363b46d2d3c78080cce926444623f/numpy-1.15.0-cp35-none-win32.whl (9.9MB)
    100% |████████████████████████████████| 9.9MB 1.3MB/s
Requirement already satisfied: pytz>=2011k in c:\users\lvcha\appdata\local\programs\python\python35-32\lib\site-packages (from pandas) (2018.5)
Collecting python-dateutil>=2.5.0 (from pandas)
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl (211kB)

    100% |████████████████████████████████| 215kB 1.8MB/s
Requirement already satisfied: six>=1.5 in c:\users\lvcha\appdata\local\programs\python\python35-32\lib\site-packages (from python-dateutil>=2.5.0->pandas) (1.11.0)
Installing collected packages: numpy, python-dateutil, pandas
Successfully installed numpy-1.15.0 pandas-0.23.4 python-dateutil-2.7.3

 在运行代码的时候控制台出现 RuntimeWarning 警告, 但是程序并没有终止运行:

numpy.dtype size changed, may indicate binary incompatibility

由该信息可以想到, 在安装 pandas 模块的时候, 一同安装了 numpy, 可能是 numpy 模块的原因, 重新安装 numpy 并不起作用

解决办法:

查阅了@独孤呆博的博客, 是由于 numpy 和 pandas 不兼容, 卸载高版本 numpy, 重装低版本

E:\练习>pip uninstall numpy
Uninstalling numpy-1.15.0:
  Would remove:
    c:\users\lvcha\appdata\local\programs\python\python35-32\lib\site-packages\numpy-1.15.0.dist-info\*
    c:\users\lvcha\appdata\local\programs\python\python35-32\lib\site-packages\numpy\*
    c:\users\lvcha\appdata\local\programs\python\python35-32\scripts\conv-template.exe
    c:\users\lvcha\appdata\local\programs\python\python35-32\scripts\f2py.exe
    c:\users\lvcha\appdata\local\programs\python\python35-32\scripts\f2py.py
    c:\users\lvcha\appdata\local\programs\python\python35-32\scripts\from-template.exe
Proceed (y/n)? y
  Successfully uninstalled numpy-1.15.0

E:\练习>pip install numpy==1.14.5
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting numpy==1.14.5
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/56/2c/3dca9665f019efbe735814564bcf4b3b71618cea5f0ccec8847361e61a24/numpy-1.14.5-cp35-none-win32.whl (9.8MB)
    100% |████████████████████████████████| 9.8MB 824kB/s
Installing collected packages: numpy
Successfully installed numpy-1.14.5

再次运行代码, 问题不再重现:

C:\Users\Lvcha\AppData\Local\Programs\Python\Python35-32\python.exe E:/练习/19_pandas.py
0    1
1    2
2    3
3    4
dtype: int64

 

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值