目录
5.安装tensorflow2的GPU版本:TC2(这名字以后我得换掉,强迫症太南了)
6.安装tensorflow1的GPU版本:TensorFlow1
1.我的电脑里都装了什么
1. anacoda 包含 jupyter notebook 和 python3.7 位置:D:\anaconda
2. pycharm 位置:D:\pycharm-2020.2.3 备注:这个文件夹里还有pycharm的破解包
3. python3.9 位置:D:\Python39 (已被删除)
4. python3.8 位置:未知(已被删除)
3. paddlepaddle库,基于anaconda(已被删除)
5. virtualenv 位置:D:\Python39\virtulenv(已被删除)
4. tensorflow1.13.1 ,命名为TF1.13.1_cpu,旗下有私有的jupyter notebook
打开方式为:打开anaconda prompt ->输入 conda activate TF1.13.1_cpu 切换到其环境下,再输入jupyter notebook打开就行
在jupyter下检查 确认为GPU 说实话算力大代码跑的真的快(已被删除,下图也不存在了)
5.TensorFlow1 :conda下载了大部分库,其中有三个库是pip来的:keras,cv2,PIL
tensorflow我都不知道卸载了多少回了,来回装了2天,最终在tf1.13.1cpu下稳定下来
最主要的是:千万不能conda和pip混用,要出大问题的(以后除了创建环境用conda create -n xxx ,其他的请勿用conda,一概用pip)
6. 如果又要删除anacoda3 ,以下为 主要配置
tensorflow-cpu:1.13.1
keras:2.1.5
numpy:1.17.4
其他的包(matplotlib pillow opencv-python 等)一概 pip 最新的就行,别忘了升级pip
2.电脑中更改过什么
1. 这个是系统盘中的C:\Windows\System32\drivers\etc\hosts 文件,0.0.0.0 account.jetbrains.com这一行可以删去,github这个是为了解决网页端图片没显示的
0.0.0.0 account.jetbrains.com #pycharm activation
# GitHub Start
192.30.253.112 Build software better, together
192.30.253.119 gist.github.com
151.101.184.133 assets-cdn.github.com
151.101.184.133 raw.githubusercontent.com
151.101.184.133 gist.githubusercontent.com
151.101.184.133 cloud.githubusercontent.com
151.101.184.133 camo.githubusercontent.com
151.101.184.133 avatars0.githubusercontent.com
151.101.184.133 avatars1.githubusercontent.com
151.101.184.133 avatars2.githubusercontent.com
151.101.184.133 avatars3.githubusercontent.com
151.101.184.133 avatars4.githubusercontent.com
151.101.184.133 avatars5.githubusercontent.com
151.101.184.133 avatars6.githubusercontent.com
151.101.184.133 avatars7.githubusercontent.com
151.101.184.133 avatars8.githubusercontent.com
# GitHub End
2. anaconda的权限被我改为了完全权限 属性->安全
3. 进入”C:\Users\Administrator“,打开“.condarc“ 其中代码被我改为
ssl_verify: true
show_channel_urls: true
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/
属于清华的镜像 参考:https://www.cnblogs.com/tianlang25/p/12433025.html
3.如何在cmd中打开不同版本的python
1.打开cmd,输入:ipython,敲回车,得到:anaconda下的py3.7
2..打开cmd,输入:python,得到python3.9
4.如何卸载xx版本的python
1.找到当初下载时的安装包,注意版本要正确
uninstall即可
目前D盘内仍保留着Py39文件夹,占将近50M存储
5.安装tensorflow2的GPU版本:TC2(这名字以后我得换掉,强迫症太南了)
参考 https://www.cnblogs.com/jshmztl/p/13306837.html
1.我们打开conda的prompt
2.在清华镜像园下安装
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 --set show_channel_urls ye
3.然后在新建一个虚拟环境
conda create -n TC2 python=3.7 //新建一个python3.7的环境,命名为TC2
4.目前命令行输出结果
激活该环境
conda activate TC2
有这个显示就说明我们进入了这个TC2
的环境,之后我们就在这个环境下安装tensorflow-gpu2.1.0
conda install tensorflow-gpu //这里也可以指定版本,比如conda install tensorflow-gpu==2.1.0
环境内安装了如下包
anaconda重命名环境:
注意不能直接重命名,比如修改txt文件都是不行的,必须克隆环境再命名,然后删除原来环境。相当于无法对环境rename,只能克隆新的。
在安装中出现了此错误
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/cudnn-7.6.5-cuda10.1_0.tar.bz2>
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.
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/mkl-2020.2-256.tar.bz2>
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.
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/hdf5-1.10.2-hac2f561_1.tar.bz2>
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.
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/cudatoolkit-10.1.243-h74a9793_0.tar.bz2>
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.
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/scipy-1.6.0-py37h14eb087_0.tar.bz2>
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.
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/tensorflow-base-2.1.0-gpu_py37h55f5790_0.tar.bz2>
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.
参考1:https://www.cnblogs.com/tianlang25/p/12433025.html
参考2.https://blog.csdn.net/qq_35668469/article/details/108284556
anaconda的权限被我改为了完全权限
随后在虚拟环境中安装jupyter notebook
pip install jupyter 太慢了无语,找了个方法光速下载
https://blog.csdn.net/lsf_007/article/details/87931823
pip install keras -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
6.安装tensorflow1的GPU版本:TensorFlow1
首先查看CUDA的版本:(通过查NVIDIA control Panel打开)
安装结果:
我在这一版本里也下了个jupyter
成功安装了TF1的对应版本
cmd环境退出python:
exit()+回车
安装keras2.1.5用conda安装总也冲突,给出的冲突报告太长了....好几个cmd大屏,尝试过升级conda,也不行。后来一气之下pip,而且没用豆瓣源,不到1分钟就下好了,conda list下竟然存在2.1.5版本 ,没想明白
插几个当时的参考:
https://blog.csdn.net/li528405176/article/details/83857286
7.conda基础指令总结
参考:https://blog.csdn.net/tianweidadada/article/details/80150056
- 查看当前系统下的环境
conda info -e
- 创建新的环境
# 指定python版本为2.7,注意至少需要指定python版本或者要安装的包# 后一种情况下,自动安装最新python版本
conda create -n env_name python=2.7
# 同时安装必要的包
conda create -n env_name numpy matplotlib python=2.7
- 环境切换
conda deactivate
- 移除环境
conda remove -n env_name --all
- 查看已经安装的package
conda list
# 指定查看某环境下安装的package
conda list -n env_name
- 更新包
conda update numpy
conda update anaconda
- 卸载包
conda remove numpy
8.pip和conda的区别
https://blog.csdn.net/justisme/article/details/100126568
9.不同的源
10.报错总结
1.
WARNING:tensorflow:From D:\anaconda\envs\TF1.13.1_gpu\lib\site-packages\keras\backend\tensorflow_backend.py:3138: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`
https://blog.csdn.net/xuan9719/article/details/99643315
https://testerhome.com/topics/20655
2.
https://blog.csdn.net/weixin_41010198/article/details/86738635