查原因:新版 tensorflow 安装包不支持较老的处理器,需要安装老版本的tensorflow。
pip install --ignore-installed --upgrade tensorflow==1.5
发现
ERROR: Could not find a version that satisfies the requirement tensorflow==1.5.0 (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0, 2.2.0rc0, 2.2.0rc1, 2.2.0rc2)
根据提示换成 1.15.0
pip install tensorflow==1.15.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
如果网络没问题,用清华镜像应该可以安装
还是不行。。。。。。
但是换成Anaconda安装就可以了
pip install tensorflow==1.15.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
tf.version
‘1.15.0’
https://blog.csdn.net/lchzh1994/article/details/81223726
如果还不行,比如:
ERROR: Cannot unpack file C:\Users\qishang\AppData\Local\Temp\pip-unpack-fwrwrq2r\simple (downloaded from C:\Users\qishang\AppData\Local\Temp\pip-req-build-pi5_wb40, content-type: text/html; charset=utf-8); cannot detect archive format
ERROR: Cannot determine archive format of C:\Users\qishang\AppData\Local\Temp\pip-req-build-pi5_wb40
再换个镜像,比如豆瓣镜像,在CMD下输入:
pip install -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple tensorflow==1.13.1
看似安装成功了,其实不然,在import tensorflow as tf之后会报 DLL加载失败,参考这篇博文。
最后使用conda install tensorflow==1.13.1安装成功:
>>> tf.__version__
'1.13.1'
Conda命令行是行了,pycharm运行又报错
import tensorflow as tf
print(tf.__versino__)
-------------------------------------------------------------------------
Original error was: DLL load failed: 找不到指定的模块。
经排查,原来是Anaconda的环境变量没有添加
加上环境变量,就没问题了。
https://blog.csdn.net/qq_30336973/article/details/90676157