【深度学习】Ubuntu16.04+Anaconda安装+换源+环境创建+tensorflow安装(3)

一、Anaconda,下载

Anaconda 是一个用于科学计算的 Python 发行版,支持 Linux, Mac, Windows, 包含了众多流行的科学计算、数据分析的 Python 包。

Anaconda 安装包可以到 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 下载。

ps:也可以去官网下载 https://www.anaconda.com/download/

列表内容
这里写图片描述

ps:本次使用的是Anaconda3-5.0.0-Linux-x86_64.sh

二、Anaconda,安装

进入文件目录:

bash ./Anaconda3-5.0.0-Linux-x86_64.sh

回车

这里写图片描述
.
.
.

全程 yes +回车 ,默认安装在home目录下

三、Anaconda,环境变量

1.检查环境变量,没有则添加

查看命令

sudo gedit ~/.bashrc

这里写图片描述
检查末尾是否已经添加如下变量,没有则添加

export PATH="/home/用户名/anaconda3/bin:$PATH"

这里写图片描述

需要重启系统,不然找不到命令

2.打开控制台 ,更换清华源(墙太高)

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

3.创建一个名flappbird 的环境

conda create -n flappbird python=3.6

创建成功

这里写图片描述

激活环境

source activate flappbird

这里写图片描述

四、tensorflow安装

给 flappbird 环境安装tensorflow

conda install -n flappbird -c https://conda.anaconda.org/jjhelmus tensorflow

这里写图片描述

五、遇到的错误+解决办法

1.如果换源之后任然无法创建环境,并且报网络连接的错误:

报错如下:

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.continuum.io/pkgs/main/linux-64/repodata.json.bz2>
Elapsed: -

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.
ConnectionError(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/main/linux-64/repodata.json.bz2 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fd5d462df28>: Failed to establish a new connection: [Errno 101] Network is unreachable',))",),)

解决办法:
打开源文件

vim  ~/.condarc

删除defaults行

这里写图片描述

2.如果安装文件夹出现一把小锁,运行命令报错

报错如下

Traceback (most recent call last):
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/exceptions.py", line 640, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/cli/main.py", line 140, in _main
        exit_code = args.func(args, p)
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/cli/main_create.py", line 68, in execute
        install(args, parser, 'create')
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/cli/install.py", line 231, in install
        unknown=index_args['unknown'], prefix=prefix)
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/core/index.py", line 101, in get_index
        index = fetch_index(channel_priority_map, use_cache=use_cache)
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/core/index.py", line 120, in fetch_index
        repodatas = collect_all_repodata(use_cache, tasks)
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/core/repodata.py", line 75, in collect_all_repodata
        repodatas = _collect_repodatas_serial(use_cache, tasks)
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/core/repodata.py", line 485, in _collect_repodatas_serial
        for url, schan, pri in tasks]
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/core/repodata.py", line 485, in <listcomp>
        for url, schan, pri in tasks]
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/core/repodata.py", line 115, in func
        res = f(*args, **kwargs)
      File "/home/joahluo/Anaconda/lib/python3.6/site-packages/conda/core/repodata.py", line 473, in fetch_repodata
        with open(cache_path, 'w') as fo:
    PermissionError: [Errno 13] Permission denied: '/home/joahluo/Anaconda/pkgs/cache/09e2740c.json'

解决办法:
运行如下命令,赋予权限

sudo chmod -R 777 Anaconda

ps:其中Anaconda是我的安装的文件夹名字

海贼王的博客 CSDN认证博客专家 数据科学家 自然语言处理 计算机视觉
本硕CS
CSDN博客专家
IBM Data Scientist
知乎《前沿AI模型》专栏作家
Google认证TensorFlow开发者
相关推荐
©️2020 CSDN 皮肤主题: 猿与汪的秘密 设计师:白松林 返回首页