利用Anaconda创建TensorFlow环境

Anaconda已经安装完成

python版本3.7

创建环境py37

conda create --name py37 python=3.7

activate py37

安装指定版本的TensorFlow

pip install  tensorflow==2.0

遇到错误可以卸载numpy,安装新的pip install numpy==1.19.3

在pycharm中添加指定环境的python.exe

国内镜像网站地址:

阿里云 http://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

豆瓣(douban)http://pypi.douban.com/simple/

清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

制定镜像地址和版本的命令:

pipinstall-i https://pypi.tuna.tsinghua.edu.cn/simple/ --upgrade tensorflow==1.9

很多程序中需要用到sklearn,安装命令:

conda install scikit-learn

第一次运行代码报错可以尝试加代码

import os

os.environ['TF_CPP_MIN_LOG_LEVEL']='2'

posted @ 2020-12-27 19:51  sharon0715  阅读(136)  评论(0)    收藏  举报