天天看點

安裝anaconda和tensorflow(windows)

Anaconda安裝時勾選All User和啟用環境變量

可切換為清華鏡像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

conda config --set show_channel_urls yes

anaconda-navigator無法打開的解決辦法

conda update anaconda-navigator

anaconda-navigator --reset

conda update anaconda-client

conda update -f anaconda-client

打開Anaconda-Navigator->Environments->base(root)修改python版本到3.6.8

python3.7目前對tensorflow2.0支援不好

在Anaconda裡建立名為tensorflow的環境

conda create -n tensorflow python=3.6.8

進入tensorflow環境

activate tensorflow

檢視Anaconda裡的環境

conda info --envs

在cmd裡先執行以下兩行

easy_install pip

pip install--upgrade pip

回到Anaconda Prompt

pip install tensorflow或

pip install --upgrade --ignore-installed tensorflow

如果報錯逾時,延長逾時時間

pip install --upgrade --ignore-installed tensorflow --default-timeout=100

安裝完成後,可以對其進行測試,在終端輸入

import tensorflow as tf

引用tensorflow包,如果沒有報錯,則安裝成功,否則就有問題。