事件背景:卸载重新安装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.7Collecting package metadata: failedCondaHTTPError: 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
因为我笔记本电脑显卡不行,就用的第一个命令。