安装tensorflow

安装tensorflow

安装Tensorflow时,需要从Anaconda仓库中下载,一般默认链接的都是国外镜像地址,下载肯定很慢啊(跨国呢!),这里我是用国内清华镜像,需要改一下链接镜像的地址。这里,我们打开刚刚安装好的Anaconda中的 Anaconda Prompt,然后输入:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
再接着输入:

conda config --set show_channel_urls yes
这两行代码用来改成连接清华镜像的

使用anaconda创建虚拟环境

conda create -n tensorflow python==3.7.7

激活虚拟环境

activate tensorflow(虚拟环境名)

让pip使用国内镜像

临时使用:

可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple

例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider,这样就会从清华这边的镜像去安装pyspider库。

永久修改,一劳永逸:

Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)

内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com

windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini。内容同上。

pip install tensorflow-gpu==2.1.0

或者

pip install tensorflow

使用jupyter notebook使用tensorflow

安装 pip install jupyter notebook

使用jupyter notebook

jupyter notebook

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值