基於Anaconda安裝tensorflow

2021-07-24 05:57:56 字數 2251 閱讀 5776

anaconda 是乙個整合許多第三方科學計算庫的 python 科學計算環境,anaconda 使用 conda 作為自己的包管理工具,同時具有自己的計算環境,類似 virtualenv.

和 virtualenv 一樣,不同 python 工程需要的依賴包,conda 將他們儲存在不同的地方。 tensorflow 上安裝的 anaconda 不會對之前安裝的 python 包進行覆蓋.

1.安裝 anaconda

2.建立乙個 conda 計算環境

3.啟用環境,使用 conda 安裝 tensorflow

4.安裝成功後,每次使用 tensorflow 的時候需要啟用 conda 環境

安裝 anaconda :

建立乙個 conda 計算環境名字叫tensorflow:

# python 2.7

$ conda create -n tensorflow python=2.7

# python 3.4

$ conda create -n tensorflow python=3.4

啟用tensorflow環境,然後使用其中的 pip 安裝 tensorflow. 當使用easy_install使用–ignore-installed標記防止錯誤的產生。

$ source activate tensorflow

(tensorflow)$  # your prompt should change

# ubuntu/linux 64-bit, cpu only, python 2.7:

(tensorflow)$ pip install --ignore-installed --upgrade

# ubuntu/linux 64-bit, gpu enabled, python 2.7. requires cuda toolkit 7.5 and cudnn v4.

# for other versions, see "install from sources" below.

(tensorflow)$ pip install --ignore-installed --upgrade

# mac os x, cpu only:

(tensorflow)$ pip install --ignore-installed --upgrade

對於 python 3.x :

$ source activate tensorflow

(tensorflow)$  # your prompt should change

# ubuntu/linux 64-bit, cpu only, python 3.4:

(tensorflow)$ pip install --ignore-installed --upgrade

# ubuntu/linux 64-bit, gpu enabled, python 3.4. requires cuda toolkit 7.5 and cudnn v4.

# for other versions, see "install from sources" below.

(tensorflow)$ pip install --ignore-installed --upgrade

# mac os x, cpu only:

(tensorflow)$ pip install --ignore-installed --upgrade

conda 環境啟用後,你可以測試

當你不用 tensorflow 的時候,關閉環境:

(tensorflow)$ source deactivate

$  # your prompt should change back

再次使用的時候再啟用:

$ source activate tensorflow

(tensorflow)$  # your prompt should change.

# run python programs that use tensorflow.

...

# when you are done using tensorflow, deactivate the environment.

(tensorflow)$ source deactivate

在windows上基於anaconda 然後安裝tensorflow不行。 windows上需要安裝虛擬機器,才能安裝tensorflow.

基於 Anaconda 安裝 tensorflow

anaconda 是乙個整合許多第三方科學計算庫的 python 科學計算環境,anaconda 使用 conda 作為自己的包管理工具,同時具有自己的計算環境,類似 virtualenv.和 virtualenv 一樣,不同 python 工程需要的依賴包,conda 將他們儲存在不同的地方。te...

CentOS 通過原始碼編譯形式安裝 Tengine

本篇簡單說說在如何在 linux 系統上通過原始碼編譯的形式安裝 tengine,純屬筆記。tengine 官網路徑 linux 版本 centos6.9 x64 tengine 版本 tengine 2.3.2.tar.gz 關閉 linux 機器防火牆 上傳 tengine 安裝包 tengin...

anaconda環境安裝

1.配置環境變數 將新增anaconda的安裝目錄新增到path 二 安裝開發包 1.安裝pip命令 完成pip的安裝 如果在x的scripts目錄下可以找到pip的可執行檔案,則說明安裝成功,反之,重複執行上步驟 最後,把x scripts新增到環境變數path上 如果命令列中鍵入pip vers...