pip进行numpy升级出现version版本过低问题

1.问题

在Python3.6版本下,一般程序如果需要numpy正常import就可以匹配,numpy版本无过分要求。但在tensorflow运行时,可能会出现以下错误:

ImportError:Something is wrong with the numpy installation. 
While importing we 	detected an older version of numpy in ['/home/.local/lib/python3.6/site-packages/numpy'].
One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.

2.解决办法

原因是tensorflow和opencv有依赖关系,numpy版本没有更新,导致出错

在尝试使用

pip3 install -U numpy

进行升级,但程序仍然出错:

One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.

用pip3 uninstall numpy卸载numpy,再用pip3 list命令查看是否还有numpy存在,若有,再继续卸载,否则老版本还是会报错。确定无numpy之后,重新安装新版本:

pip3 install numpy

安装成功,可以正常运行程序。

 

你可能感兴趣的:(#,python库安装)