Anaconda 安装包可以到清华 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 下载可选择之前的版本。或者https://www.anaconda.com/download/#linux官网下载地址,最新版本。
不添加镜像,或者添加清华镜像https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/好处是下载快(其实我感觉差不多速度)自行选择。清华镜像添加是执行下面几句
代码语言:javascript复制conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
然后执行
bash bash Anaconda2-5.1.0-Linux-x86_64.sh
、
我官网下的最新版。
然后一路回车,出现下面这个时候,输入yes.
Do you accept the license terms? [yes|no] [no] >>> yes #这输入yes
然后出现
Do you wish the installer to prepend the Anaconda2 install location to PATH in your /home/wn/.bashrc ? [yes|no] [no] >>> yes #[no]的意思是默认no,这输入yes
Appending source /home/wn/anaconda2/bin/activate to /home/wn/.bashrc
A backup will be made to: /home/wn/.bashrc-anaconda2.bak
需要重新开启新的服务器。
最后然后出现
代码语言:javascript复制Anaconda is partnered with Microsoft! Microsoft VSCode is a streamlined
code editor with support for development operations like debugging, task
running and version control.
To install Visual Studio Code, you will need:
- Administrator Privileges
- Internet connectivity
Visual Studio Code License: https://code.visualstudio.com/license
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]
#让你安装VS,不安,输入no
然后我们接下来创建虚拟环境
代码语言:javascript复制# 创建一个名为S2P的环境,指定Python版本是2.7
conda create --name S2P python=2.7
#查看刚才创建的所有环境
conda list env
# activate激活S2P
source activate S2P
# 激活后,会发现terminal输入的地方多了S2P的字样,实际上,此时系统做的事情就是把默认环境从PATH中去除,再把当前2.7加入PATH
python --version
# 可以看到系统已经切换到了2.7的环境
# 如果想返回默认的python环境,运行
source deactivate S2P
# 删除刚才创建的环境S2P
conda remove --name S2P --all
接下来在虚拟环境中安装tensorflow
anaconda search -t conda tensorflow #查看版本和资源
image.png
然后决定你想要下载哪个版本
代码语言:javascript复制 anaconda show cjj3779/tensorflow-gpu
Using Anaconda API: https://api.anaconda.org
Name: tensorflow-gpu
Summary: TensorFlow helps the tensors flow
Access: public
Package Types: conda
Versions:
1.4.0
To install this package with conda run:
conda install --channel https://conda.anaconda.org/cjj3779 tensorflow-gpu
根据提示,我们可以执行
conda install --channel https://conda.anaconda.org/cjj3779 tensorflow-gpu
当然,可以选择清华的
https://mirrors.tuna.tsinghua.edu.cn/help/tensorflow/#这里有各种资源
代码语言:javascript复制tf.__version__
tf.__path__
执行上面两句话,就可以了