![](/img/trans.png)
[英]Anaconda cannot downgrade python to 3.6, and cannot install tensorflow
[英]how to install tensorflow on anaconda python 3.6
我用 anaconda 包安裝了新版本的 python 3.6。 但是我無法安裝 tensorflow。 總是收到錯誤
tensorflow_gpu-1.0.0rc2-cp35-cp35m-win_amd64.whl 在此平台上不受支持。
如何在 anaconda (python 3.6) 上安裝 tensorflow?
更新: TensorFlow 從 1.2.0 版開始支持 Windows 上的 Python 3.6(請參閱發行說明)
TensorFlow 目前僅支持 Python 3.5 64 位。 對 Python 3.6 的支持正在進行中,您可以在此處進行跟蹤,也可以在討論中加入。
目前在 Windows 上使用 Python 3.6 和 TensorFlow 的唯一替代方法是從源代碼構建 TF。
如果您不想卸載 Python 3.6 的 Anaconda 發行版並安裝以前的版本,您可以為 Python=3.5 創建一個 conda 環境,如下所示: conda create --name tensorflow python=3.5 activate tensorflow pip install tensorflow-gpu
這就是我在 Window 10 64bit 上安裝 Anaconda Python 3.6 版本和 Tensorflow 所做的事情。它成功了!
通過調用以下命令創建一個名為 tensorflow 的 conda 環境:
C:> conda create -n tensorflow
通過發出以下命令激活 conda 環境:
C:> activate tensorflow (tensorflow)C:> # Your prompt should change
從這里下載“tensorflow-1.0.1-cp36-cp36m-win_amd64.whl”。 (就我而言,文件下載后將位於“C:\\Users\\Joshua\\Downloads”中)。
使用以下命令安裝 Tensorflow:
(tensorflow)C:>pip install C:\\Users\\Joshua\\Downloads\\ tensorflow-1.0.1-cp36-cp36m-win_amd64.whl
通過在 Python 環境中輸入以下命令來驗證安裝:
import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello))
如果你得到的輸出是“你好,TensorFlow!”,這意味着你已經成功安裝了你的 Tensorflow。
從頭開始的簡單方法。
從https://repo.anaconda.com/archive/Anaconda3-5.2.0-Windows-x86_64.exe下載 Anaconda
雙擊安裝 Anaconda。
通過在 Windows 搜索中搜索 anaconda 來打開 anaconda 提示符,並在連接到互聯網時鍵入以下命令。
A. conda create -n tensorflow_env python=3.6
B. conda activate tensorflow_env
C. conda install -c conda-forge tensorflow
步驟 C 需要時間。 安裝后在 conda 提示符下鍵入python
並鍵入
import tensorflow as tf
如果沒有發現錯誤,則說明安裝成功。
根據: https : //anaconda.org/intel/tensorflow
要使用 conda 安裝此軟件包,請運行:
conda install -c intel tensorflow
pip install 使用 pip 安裝這個包:
pip install -i https://pypi.anaconda.org/intel/simple tensorflow
好吧, conda install tensorflow
對我來說conda install tensorflow
完美!
我按照其中一位用戶的說法使用了這種方法:這就是我在 Window 10 64bit 上安裝 Anaconda Python 3.6 版本和 Tensorflow 時所做的。它成功了!
前往https://www.continuum.io/downloads下載適用於 Window 64 位的 Anaconda Python 3.6 版本。 通過調用以下命令創建一個名為 tensorflow 的 conda 環境:
C:> conda create -n tensorflow 通過發出以下命令激活 conda 環境:
C:> activate tensorflow (tensorflow)C:> # 你的提示應該改變 Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/enter code here download “tensorflow-1.0.1-cp36-cp36m- win_amd64.whl”。 (就我而言,該文件下載后將位於“C:\\Users\\Joshua\\Downloads”中)使用以下命令安裝 Tensorflow:
(tensorflow)C:>pip install C:\\Users\\Joshua\\Downloads\\tensorflow-1.0.1-cp36-cp36m-win_amd64.whl
但在提示中沒有任何反應。 它從帶有張量流的新行開始,就好像什么都沒寫一樣。 有什么問題?
卸載 Python 3.7 for Windows,只安裝 Python 3.6.0 那么你就沒有問題或收到錯誤信息:
將 tensorflow 導入為 tf ModuleNotFoundError:沒有名為“tensorflow”的模塊
這適用於我的 CPU 安裝
pip install --upgrade tensorflow # for python 2.x
pip3 install --upgrade tensorflow # for python 3.x
對於帶有 Anaconda 4.4 Python 3.6 的 Windows 10:
第一步) conda create -n tensorflow python=3.6
第二步) activate tensorflow
第三步) pip3 install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp36-cp36m-win_amd64.whl
conda create -n tensorflow_gpuenv tensorflow-gpu
或者
在命令提示符 (cmd) 中鍵入命令 pip install c:.*.whl。
請參考此鏈接:
選擇 Windows 或鏈接的基本命令,就我而言,我使用了 Linux:
創建一個新的 Anaconda 虛擬環境打開一個新的終端窗口
輸入以下命令:上面將創建一個名為 tensorflow的新虛擬環境
conda create -n tensorflow pip python=3.8
conda activate tensorflow
我將把它留在這里,因為其他方法都不適合我。 另外,當我需要它用於新設備時,我可以自己查找。
conda create --name tensorflow
conda activate tensorflow
conda search tensorflow
所有可用的 TensorFlow 版本1.14
版): conda install -c conda-forge tensorflow=YOUR_VERSION
.dll
-File添加到Windows\\System32
文件夾現在它應該像魅力一樣工作!
如果它仍然不起作用,試試這個,它對我有用:
打開 Anaconda-Prompt:
Python 3.6
創建一個環境: conda create --name tensorflow_env python=3.6
conda activate tensorflow
conda install tensorflow=YOUR_VERSION
(不是偽造的,就像這樣!) 如果您想使用 GPU,請按照上述相同的方式進行操作,唯一的區別是安裝tensorflow-gpu
而不是tensorflow
。
而且,您必須為您的 GPU 安裝最新的 NVIDIA 驅動程序,您可以在此處找到並選擇正確的驅動程序。
(是的,在 TF 2 中,“普通”庫中同時支持 CPU 和 GPU。但是,如果您通過tensorflow-gpu
安裝tensorflow-gpu
,它會自動為您安裝 CUDA 和 cudNN 等 - 也是正確的版本。這種方式更容易、更快。)
有其他方法不需要太難請按照我的步驟1)首先創建一個新環境只需打開Anaconda#然后點擊Environments##創建一個新環境然后在名稱中寫入環境:Tensor_flow然后選擇Python從像 python3.7 或 3.8 這樣的 dropbox 並點擊創建它會創建一個 tensor_flow 環境 2) 第二次點擊創建的 Tensor_flow 環境必須選擇 tensor_flow 創建的環境 # 然后點擊安裝它會顯示所有安裝包寫 TensorFlow 然后點擊安裝 TensorFlow # # 然后選擇 Keras 並安裝 Keras 3)點擊主頁按鈕 # install juptytorNotebook ###lunchJupytorNotebook 4) 現在開始菜單搜索框寫 Jupiter 它會顯示 jupytorNotebok + JupytorNotebookTensorFlow 但你必須選擇 JupytorNotebookTensorFlow 所以點擊 JupytorNotebookTensorFlow 然后選擇python 編寫 import TensorFlow as tf 也檢查 from TensorFlow import Keras 謝謝你,如果你不知道請告訴我我會幫助你。 https://towardsdatascience.com/https-medium-com-ekapope-v-install-tensorflow-and-keras-using-anaconda-navigator-without-command-line-b0bc41dbd038
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.