记用清华镜像安装Anconda --Ubuntu
安装Anconda
因为在官网下载会很久,所以使用清华镜像进行下载,所以我们先要去清华镜像的官网查找要下载的版本的地址(PS:如果是桌面版的Ubuntu可直接在浏览器上查找地址为https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
),非桌面版只能通过命令行:
一下命令我都会直接在管理员账号下运行即先运行sudo su
命令,并在输入管理员密码
sudo wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda2-2.4.1-Linux-x86_64.sh
sudo bash Anaconda2-2.4.1-Linux-x86_64.sh
1.安装程序将提示 In order to continue the installation process, please review the license agreement.
单击Enter查看许可条款,滚动到许可条款的底部,然后输入“yes”以表示同意
2.安装程序提示您单击Enter接受默认安装位置,按CTRL-C取消安装,或指定备用安装目录。如果接受默认安装位置,则安装程序将显示“ PREFIX = / home / <用户> / anaconda <2或3>”并继续安装。可能需要几分钟才能完成。
3.安装程序提示“您是否希望安装程序通过运行conda init来初始化Anaconda2?” 建议“yes”。
PS:到这里记住圈出的这个路径,一般都是默认一样的,后面要配置环境变量。
4. 将Anaconda执行文件路径(即上图我圈住的路径)加入到PATH。
sudo gedit ~/.bashrc
打开编辑器屏幕显示界面,输入:
export PATH="/root/anaconda2/bin:$PATH"
6. 所以直接关闭并打开终端窗口以使安装生效,或者您可以输入命令。
source ~/.bashrc
7.查看Anaconda版本 ,每个Anaconda版本会对应一个Python版本,此次安装的Anaconda2.4.1对应的Python版本是2.7.1
python --version
安装 tensorflow
- 建立一个conda计算环境名字叫tensorflow
conda create -n tensorflow python=2.7
激活tensorflow 环境,然后使用其中的pip安装TensorFlow,如果pip没有安装的话,执行以下命令
(建议先更改apt-get和pip的源)
sudo apt-get install python-pip python-dev
激活tensorflow 环境
source activate tensorflow
安装tensorflow=1.12
pip install tensorflow
conda install tensorflow=1.2
如果出现以上相应超时的问题,可以运行此命令:
pip --default-timeout=100 install tensorflow