- 下載anaconda,官網(wǎng)下載最新版本,帶界面。地址:https://www.continuum.io/downloads
- 安裝下載的anaconda的pkg安裝包,一路同意。
- 程序會(huì)自動(dòng)在bash_profile中添加環(huán)境變量的配置,需要source一下。
- 添加清華大學(xué)的鏡像源,這樣會(huì)在~目錄下生成一個(gè).condarc的文件。
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
5. 查看cat .condarc的內(nèi)容。
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
ssl_verify: true
show_channel_urls: true
6. 一般命令。
conda list
# 查看某個(gè)指定環(huán)境的已安裝包
conda list -n python34
# 查找package信息
conda search numpy
# 安裝package
conda install -n python34 numpy
# 如果不用-n指定環(huán)境名稱,則被安裝在當(dāng)前活躍環(huán)境
# 也可以通過(guò)-c指定通過(guò)某個(gè)channel安裝
# 更新package
conda update -n python34 numpy
# 刪除package
conda remove -n python34 numpy
7. 可以看一下python的版本。
python --version
Python 2.7.13 :: Anaconda 4.4.0 (x86_64)
8. 安裝tensorflow的環(huán)境。
conda create -n tensorflow python=2.7
此時(shí)會(huì)下載相關(guān)的安裝包,如下:
certifi: 2016.2.28-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
openssl: 1.0.2l-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
pip: 9.0.1-py27_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
python: 2.7.13-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
readline: 6.2-2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
setuptools: 36.4.0-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
sqlite: 3.13.0-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
tk: 8.5.18-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
wheel: 0.29.0-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
zlib: 1.2.11-0 [https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free](https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free)
9. 激活tensorflow
$ source activate tensorflow #切換到了tensorflow的環(huán)境了
$ (tensorflow) ? ~ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.10.0-py2-none-any.whl
$ (tensorflow) ? ~ pip install --ignore-installed --upgrade $TF_BINARY_URL
#此時(shí)安裝的東西為tensorflow以及相關(guān)的依賴。
10. 想要試用spyder來(lái)編輯py文件,還是需要在tensorflow的環(huán)境中安裝spyder,因?yàn)榘惭b的tensorflow并沒(méi)有存在于conda list中,所以需要在環(huán)境中安裝。安裝方法是anaconda navigate中選擇環(huán)境,然后安裝spyder。
11. 重啟tensorflow環(huán)境,打開spyder即可!