使用命令安装numpy失败解决方案

pip install numpy

主要是国内访问国际网络较差,使用清华源即可安装

pip install numpy scipy matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple

安装后验证模块使用导入模块语言

import numpy as np

出现如下错误:

RuntimeError: The current Numpy installation ('C:\\Users\\Winter-PC\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. 
See this issue for more information: https://tinyurl.com/y3dm3h86

网络查找一番尚未查找到具体原因,可能安装numpy的版本与当前Python3.7.0版本不兼容造成。

删除已安装的numpy版本,在PowerShell中使用命令

pip uninstall numpy

出现卸载失败提示,故到安装目录“C:\Users\Winter-PC\AppData\Local\Programs\Python\Python37\Lib\site-packages”删除与numpy、numpy-19.14.dist-info文件夹

使用Everything搜索

easy-install.pth

 使用记事本打开删除掉numpy相应行

安装指定版本的numpy包

pip install numpy==1.19.3 scipy matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple

本人使用该本版后使用导入模块命令正常。

此方法仅供参考