今天安装tensorflow遇到的问题,第一次pip install tensorflow安装显示连接源timeout, 解决方案如下:
1 # 设置超时时间 2 pip --default-timeout=100 install tensorflow
然后,又产生一个新问题,如下:
1 Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/ 2 Collecting tensorflow 3 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/fb/59/1446c28d5dec00609ab664217acdbd37cf93704ae37233c1392465fc49e5/tensorflow-2.3.0-cp38-cp38-macosx_10_11_x86_64.whl (165.2 MB) 4 |██████▊ | 35.0 MB 1.1 kB/s eta 1 day, 7:52:58 5 ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them. 6 tensorflow from https://pypi.tuna.tsinghua.edu.cn/packages/fb/59/1446c28d5dec00609ab664217acdbd37cf93704ae37233c1392465fc49e5/tensorflow-2.3.0-cp38-cp38-macosx_10_11_x86_64.whl#sha256=44c8d979b2d19ed56dbe6b03aef87616d6138a58fd80c43e7a758c90105e9adf: 7 Expected sha256 44c8d979b2d19ed56dbe6b03aef87616d6138a58fd80c43e7a758c90105e9adf 8 Got f27f1cad9e4c3f38c8d25067ff1a1cea5304bc2c8351d31def4f87201a19b9ef
解决方案如下:
1 # 即卸载干净之后,再重装 2 pip uninstall tensorflow 3 pip --default-timeout=100 install tensorflow
网上有博主提供直接升级安装的方式,没有试,不过应该是可行的,粘出来供大家参考:
1 pip install --upgrade tensorflow
希望对你有帮助~