mac上搭建anaconda環(huán)境

  1. 下載anaconda,官網(wǎng)下載最新版本,帶界面。地址:https://www.continuum.io/downloads
  2. 安裝下載的anaconda的pkg安裝包,一路同意。
  3. 程序會(huì)自動(dòng)在bash_profile中添加環(huán)境變量的配置,需要source一下。
  4. 添加清華大學(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即可!

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容