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
进入文件目录:
bash ./Anaconda3-5.0.0-Linux-x86_64.sh
回车
全程 yes +回车 ,默认安装在home目录下
查看命令
sudo gedit ~/.bashrc
export PATH="/home/用户名/anaconda3/bin:$PATH"
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
conda create -n flappbird python=3.6
创建成功
激活环境
source activate flappbird
给 flappbird 环境安装tensorflow
conda install -n flappbird -c https://conda.anaconda.org/jjhelmus tensorflow
报错如下:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url
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(': Failed to establish a new connection: [Errno 101] Network is unreachable',))" ,),)
解决办法:
打开源文件
vim ~/.condarc
删除defaults行
报错如下
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
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是我的安装的文件夹名字