关于anaconda:anaconda安装及配置

13次阅读

共计 1694 个字符,预计需要花费 5 分钟才能阅读完成。

事件背景:卸载重新安装 anaconda,发现以前很多配置办法都遗记了,尽管能在百度搜寻到,但有必要记录一下,以备下次参考。

1 装置 anaconda
为了钻研须要,以后装置的版本是 Anaconda3-5.1.0-Windows-x86_64.exe。anaconda 的各种版本能够在上面网站中找到:
https://mirrors.tuna.tsinghua…

2 配置下载镜像
配置下载镜像的次要目标是为了装置一些包的时候比拟快,毕竟连到国外的速度是比较慢的。
a 关上 anaconda prompt 命令行,输出 conda config –show channels,能够查看以后曾经设置的镜像,因为我的还没设置,所以显示是 defaults。
b 增加镜像
conda config –add channels [urls…]
上面是清华的镜像:
https://mirrors.tuna.tsinghua…
https://mirrors.tuna.tsinghua…
上面是我的增加的镜像:

留神:这个在前面会报错
输出上面命令(把 https 改成 http):

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

3 创立虚拟环境 nlp_ner
a 查看以后虚拟环境
输出命令:conda env list

b 输出命令:conda create -n nlp_ner python=3.7
后果在创立虚拟环境时遇到了一个谬误:

(base) C:\Users\Administrator>conda create -n nlp_ner python=3.7
Collecting package metadata: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'mirrors.tuna.tsinghua.edu.cn\', port=443): Max retries exceeded with url: /anaconda/cloud/pytorch/win-64/repodata.json (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'ssl3_get_server_certificate\', \'certificate verify failed\')],)",),))',),)

这是因为后面设置镜像有问题,须要把 https 改成 http。

再次输出 conda create -n nlp_ner python=3.7
一路顺畅!
两头要输出一个 yes,创立的虚拟环境门路在:C:\ProgramData\Anaconda3\envs 中。

3 装置 TensorFlow1.15.0
a 进入虚拟环境
输出命令:conda activate nlp_ner

留神后面括号中的名字,就是你的虚拟环境名字
b 装置 tensorflow 1.15.0
下载 tensorflow 1.15.0,可抉择下载 CPU 版本或者 GPU 版本
conda install tensorflow-cpu==1.15.0
conda install tensorflow-gpu==1.15.0
因为我笔记本电脑显卡不行,就用的第一个命令。

正文完
 0