首页 > 技术文章 > Pycharm 安装 tensorflow 的一些坑

ay2021 2021-02-12 20:52 原文

Round 1:

打开PyCharm,点击File->Settings,点击弹出界面的“+”号,在搜索框中键入关键字 “tensorflow”,从列表中选中 “tensorflow”,点击下方的 “Install Package”,等待一段时间,华丽丽的安装失败了 -_-
在这里插入图片描述

Round 2:

在 Pycharm 的 terminal 中运行 pip install tensorflow,在等了半小时后,倒计时还有3个多小时,我弃疗了!安装失败!
在这里插入图片描述

Round 3:

以上用的都是官方的源,现在考虑换成国内的源:
阿里云 http://mirrors.aliyun.com/pypi/simple/
豆瓣(douban) http://pypi.douban.com/simple/
在这里插入图片描述
在这里插入图片描述
现在用方案一下载,把三种源都试一遍,全部失败。

Round 4:

在 Pycharm 的 terminal 中运行

pip install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple

这样就会临时使用清华大学的pypi镜像去安装 tensorflow 库了。
在这里插入图片描述
失败!

Round 5、

此时我想可能是无线网网速不行的问题,于是插上网线,在试了一次方案四:
在这里插入图片描述
哇咔咔!网速蹭蹭的!看着倒计时还有12秒我内心狂喜,然后,倒计时的数字又在迅速变大!!!又失败了!
在这里插入图片描述

Round 6:

搜其他教程,终于又发现了一种方法:
如果所使用的镜像源是未采用https加密协议的镜像网站,则会产生"网站不受信任的问题",此时需要指定 –trusted -host参数手动授权信任。
pip install tensorflow -tools -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
然而,这次没有漫长的等待,瞬间凉凉!
在这里插入图片描述

Round 7:

在吃了几个小橘子冷静了会儿后,我又搜集了其他国内的源:
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
其中清华的镜像源5分钟同步官网一次,建议使用。
在这里插入图片描述

这一次我连着网线,用方案一把所有源一个个挨着试,一遍遍挨着试,终于在一次回到电脑前准备试下一个的时候,安装成功了!!!
在这里插入图片描述

呐!是它!是它!!就是它!!!
阿里云 http://mirrors.aliyun.com/pypi/simple/
在这里插入图片描述
在这里插入图片描述

 

推荐阅读