在Anaconda中创建新环境+下载tensorflow-gpu=1.13.1

【整理自用】

1. 打开Anaconda Prompt

2.(base) C:UsersASUS>conda create -n tf13 python=3.6.5

注:我的python版本是3.6.5

3.安装失败:Solving environment: failed

4.将下面的内容粘贴在 .condarc文件中即可。

注:.condac文件可通过在anaconda prompt中输入“conda config --show-sources"找到

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

5.依旧创建失败,解决办法:清华的镜像源不能用https,换成http

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

然后:

(base) C:UsersASUS>conda create -n tf13 python=3.6.5
Solving environment: done

新环境安装成功

6.激活tf13环境,并在其中下载安装tensorflow-gpu==1.13.1

conda activate tf13

(tf13) C:UsersASUS>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu==1.13.1

7.下载tensorflow model1.13

https://codeload.github.com/tensorflow/models/zip/v1.13.0 下载完成后,解压,重命名为models,拷贝到TensorFlow的安装路径下面,即放到:./site-packages/tensorflow文件夹里面 (F:Anaconda3envs f13Libsite-packages ensorflow)

#Anaconda常用命令
activate // 切换到base环境
activate learn // 切换到learn环境
conda create -n learn python=3.7.1 //创建一个名为learn的环境并指定python版本为3(的最新版本)
conda env list // 列出conda管理的所有环境
conda list // 列出当前环境的所有包
conda install requests 安装requests包
conda remove requests 卸载requets包
conda remove -n learn --all // 删除learn环境及下属所有包
conda update requests //更新requests包
conda env export > environment.yaml // 导出当前环境的包信息
conda env create -f environment.yaml // 用配置文件创建新的虚拟环境

8.在需要的虚拟环境中安装spyder:conda install spyder==4.1.3

9.安装好后,再次输入:pip install spyder==4.1.3(确保所有依赖成功安装)

10.再conda install spyder-kernels=1.9.3

11.运行anaconda提示无法定位程序输入点**/pythoncom36.dll:

解决方法是:保留路径Anaconda3envs(你的虚拟环境)Libsite-packagespywin32_system32       下的pythoncom36.dll;同时删除路径Anaconda3envs(你的虚拟环境)       下所有其他pythoncom36.dll,我删除了“F:Anaconda3envs f13Libraryin”中的,和“F:Anaconda3envs f13”中的。

12.之前用pip安装tensorflow成功出现无法导入的问题,用pip uninstall tensorflow1.13.1后,尝试用conda install tensorflow-gpu==1.13.1 python==3.6.5安装,但屡次失败,从此步开始删除虚拟环境tf13,重新新建:

(tf13) C:UsersASUS>conda deactivate
(base) C:UsersASUS>conda env remove --name tf13
(base) C:UsersASUS>conda create -n tf13 python=3.6.5
(base) C:UsersASUS>activate tf13
(tf13) C:UsersASUS>conda install tensorflow-gpu==1.13.1 python==3.6.5

注:重新来过后,没有出现条文11中的问题 

下载再次失败,怀疑是内存不够的原因,于是将整个Anaconda3文件夹从F盘移动到了H盘,但Anaconda Prompt等快捷方式打开的应用无法找到指定内容:

打开该应用所在位置,右键属性修改目标中的内容:F→H(注意环境变量也要修改)

watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAcGhpbGlwX3BvbmQ=,size_12,color_FFFFFF,t_70,g_se,x_16

13.另一个较全文章:https://blog.csdn.net/qq_42827473/article/details/106482602

14.下载安装tf13环境下的spyder,我做了以下尝试:

(1)conda install spyder【失败】

(2)根据报错,在系统变量中新建:

watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAcGhpbGlwX3BvbmQ=,size_18,color_FFFFFF,t_70,g_se,x_16

(3)在Anaconda Prompt中依次输入以下内容:

conda remove spyder-kernels【报错说不存在,不理会,继续下面内容】

conda install spyder-kernels=0.*

conda install spyder=3.3.1【成功】【打开spyder失败,出现错误】

conda uninstall spyder=3.3.1【怀疑是版本不匹配】

conda install spyder【成功,确认搜索匹配版本为spyder=3.3.6】

打开spyder仍出现同样错误,解决办法:把anaconda根目录下的python.exe和pythonw.exe添加入防火墙

【还是失败,选择漠视错误提示】

(4)新问题:spyder工作台一直处于connecting the kernel,无法正常使用

解决办法:卸载spyder,重新进行8910条内容:

【8.在需要的虚拟环境中安装spyder:conda install spyder==4.1.3

9.安装好后,再次输入:pip install spyder==4.1.3(确保所有依赖成功安装)

10.再conda install spyder-kernels=1.9.3】

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值