ubuntu 18.04TSL安装tensorflow(cpu)

参考:https://blog.youkuaiyun.com/zzc15806/article/details/73662491

输入python查看自己的python版本,然后利用conda命令创建对应的环境

conda create -n tensorflow python=3.7

开始报错:
在这里插入图片描述方法一
参考:https://blog.youkuaiyun.com/yanhe156/article/details/78289929
修改国内镜像源

sudo gedit .condarc

删除 - default 所在的行

.condarc的内容应该是

channels:
  - http://mirrors.ustc.edu.cn/anaconda/pkgs/free/
show_channel_urls: true

可是修改完了我这里还是不可以下载~失败!但是问题变了一个,如下:
大致意思是说我没有python=3.7的包
在这里插入图片描述
参考:https://blog.youkuaiyun.com/ac540101928/article/details/73520180

conda install package_name

但是还是报错了,然后创建环境,还是说我缺少python3.7的包。

An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
[y/N]: n

No report sent. To permanently opt-out, use

    $ conda config --set report_errors false

参考:https://cloud.tencent.com/developer/ask/212137
首先查看我现在的包有啥,如下图,我的python是3.7.0,默认python是2.7.3

conda list

在这里插入图片描述所以我们改创建环境为

conda create -n tensorflow python=3.7.0

在这里插入图片描述这下创建环境python=3.7.0的时候,不再提示缺少python=3.7.0的包,这说明出现这样的包缺少提示错误,要先查看自己有什么包,并且查看对应的版本,一是为了不要盲目的下载(像我上一步那样),二就是有什么包自己心里有数。
回归正题,似乎还是原来出现过的问题,修改.condarc文件,然后换源。
前辈们说源要有一个一个试,不要一次就全部贴上去。
参考:
https://blog.youkuaiyun.com/u013985879/article/details/82818822
https://blog.youkuaiyun.com/JessieLiu_/article/details/80112278

sudo gedit .condarc
channels:
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 
    show_channel_urls: true
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

这次问题又变了

在这里插入图片描述茶资料说还是换源就可以,可是我换了也没用阿!!!!!
参考:https://blog.youkuaiyun.com/qq_32644121/article/details/83507451
这时我意识到是不是不可以直接手动将源贴进去,而且一直出现下面的提示:
好像是在告诉我修改失败。

(gedit:10367): IBUS-WARNING **: 15:25:40.427: The owner of /home/abc/.config/ibus/bus is not root!

** (gedit:10367): WARNING **: 15:33:34.264: Set document metadata failed: 不支持设置属性 metadata::gedit-position

于是我搜索命令添加源的办法:
但是好多都是win环境下~
参考:http://blog.sina.com.cn/s/blog_65b3bb6f0102yq9u.html
报错:sudo: conda:找不到命令
在这里插入图片描述百度后,前辈说,conda找不到命令可能是配置文件没有anaconda3的路径
参考:https://www.cnblogs.com/wwwjjjnnn/p/9391103.html
于是

打开Terminal

1、使用命令:sudo apt install vim 安装vim文本编辑器
2、使用命令:vim ~/.bashrc 修改环境变量

3、在文本最后添加命令:export PATH=~/anaconda3/bin:$PATH

4、重启环境变量:source ~/.bashrc

5、输入:anaconda -V

但是这个帖子和我的帖子比较像,但是好像我的上面还有sudo。。。。
到这里~我整了一天的耐心基本没了~心好累阿。。。。

----------------------------------------------分割线--------------------------------------------------------------------
玩了一会儿,感觉好多了!继续吧!
抱着试一试的态度,用pip装了一下(conda自带pip),竟然可以下载了,OMG。。。

pip install tensorflow

在这里插入图片描述但是紧接着就报错了~~~~
在这里插入图片描述百度呗~~还能咋阿
参考:https://www.cnblogs.com/xiaoxuebiye/p/9890205.html

pip install  PyHamcrest
pip install  argparse

还是权限不够,这次用root~~~成功了

root@abc-ThinkCentre-M910s-N000:/home/abc# apt install python-pip
root@abc-ThinkCentre-M910s-N000:/home/abc# pip install  PyHamcrest

在这里插入图片描述--------------------分割线--------------------------------

上次没有安装好,因为总是出现以下问题:
1、An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
2、还有404错误。。。吧啦吧啦
3、还有就是下载的源有问题,各种标红一大片。。。。

以上问题百度后,得到的最多的结果就是要更换下载的源地址。。。然而换了很多,类似清华的、中科大的都不管用。。。后来我同学告诉我,国内的tensorflow
源都不能用,只能从官网下。。。。于是,就硬着头皮耗着时间。。。下载。。。。
最后前后折腾了3四天,终于ok了。,,,

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值