通過Anaconda安裝TensorFlow環境

2021-08-09 07:26:58 字數 2061 閱讀 1090

安裝 anaconda :

參考 anaconda安裝

1、建立環境

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

# python 2.7

$ conda create -n tensorflow python=2.7

# python 3.4

$ conda create -n tensorflow python=3.4

2、啟用

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

url of the tensorflow python package

$ 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 環境啟用後,你可以測試:

$ python

>>> import tensorflow as tf

>>> print(tf.__version__)

# 0.11.0rc0

3、開啟或關閉環境

當你不用 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

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

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

通過Anaconda安裝Python3 7

成功示例截圖 備註說明一下 在使用anaconda套件安裝之前,電腦已經通過安裝包成功裝了python3.6.7 win7 64位系統 點選執行進行下一步 點選next繼續 同意協議並繼續 選擇所有人點next繼續 選擇安裝路徑,繼續 全部勾選上 等待安裝 安裝完成 skip win r,輸入cmd...

通過Anaconda安裝 切換多版本python

anaconda安裝之後,會預設某個python版本為系統使用的版本,比如3.7 命令列輸入以下命令會列數當前系統有哪些版本的python,前面帶 號表示正在使用的版本 conda info envs輸入結果如下,其中base 表示安裝anaconda時的預設版本 安裝其他版本的命令為 conda ...