先安装好pycharm和Anaconda
用conda安装tensorflow
打开anaconda prompt
将conda的下载源切换为清华源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
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 --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
搜索时显示通道地址:
conda config --set show_channel_urls yes
然后打开 C:\Users\用户名 路径下的.condarc文件 删除掉-default那一行 保存
建立和**tensorflow虚拟环境
查看已安装的虚拟环境:(最开始只有base)
conda env list
查看python版本
python --version
创建tensorflow虚拟环境(这里xxxx是虚拟环境的名字,随便取)
conda create --name xxxx python=3.7.0
conda create --name tensorflow python=3.7.0 (我这里用的是 tensorflow)
这里会让你安装一些基础的包 安装就可以此时再查看环境就会多出来一个虚拟环境了,接下来我们就是要在这个环境里进行安装啦~
**tensorflow环境
conda activate xxxx #开启xxxx环境
conda deactivate xxxx #关闭环境
conda activate tensorflow
你就会发现前面由(base)变为了(tensorflow),说明现在已经切换进tensorflow环境里来了
安装tensorflow包
conda install tensorflow
输入 y 确认安装
Pycharm 配置刚安装好的tensorflow
File --> Settings -->
project --> python interpreter -->右上角小按钮 --> Add
然后看图操作(写累了哈哈~~)
找到你的Anaconda安装路径 --> envs --> tensorflow -->python.exe (我的是在D:\applacations\Anaconda\envs\tensorflow\), 选中它 ,再点击OK
会看到
点击ok
等待加载环境ing````````
导入包运行一下试试
import tensorflow as tf
print(tf.version)
成功!!!
本博文参考:
https://blog.csdn.net/ytusdc/article/details/99699228
https://blog.csdn.net/ebzxw/article/details/80701613
https://www.jb51.net/article/185004.htm
欢迎留言交流,转发+点赞+关注~~, 感谢~~