当前位置: 首页 > news >正文

conda建立keras和pytorch环境

0:最直接

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero.

1. 目录C:\Users\Administrator下.condarc文件内容修改为如下

https://www.cnblogs.com/tianlang25/p/12433025.html

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/
设置一下 : pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

2 添加清华源如torch的镜像源头:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

3. keras的安装如下:

conda create -n keras python=3.6.5 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ pip install h5py==2.8.0 -i https://pypi.tuna.tsinghua.edu.cn/simple pip install tensorflow-gpu==1.6.0 -i https://pypi.tuna.tsinghua.edu.cn/simple pip install Keras==2.1.5 -i https://pypi.tuna.tsinghua.edu.cn/simple pip install scikit-image==0.15.0 -i https://pypi.tuna.tsinghua.edu.cn/simple pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple

4. pytorch安装如下:

# CUDA 9.2 conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=9.2 -c pytorch # CUDA 10.1 conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch # CUDA 10.2 conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.2 -c pytorch # CPU Only pip install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

另外安装离线torch cpu版本

下载离线资源:https://download.pytorch.org/whl/torch_stable.html

pip install D:\torch\torch-1.6.0+cpu-cp36-cp36m-win_amd64.whl -i http://pypi.douban.com/simple --trusted-host=pypi.douban.com
pip install D:\torch\torchvision-0.7.0+cpu-cp36-cp36m-win_amd64.whl -i http://pypi.douban.com/simple --trusted-host=pypi.douban.com

最后3090显卡(CUDA11.1)安装Pytorch

由于官方暂时没有11.1版本的Pytorch安装方法,可以使用11.0版本的安装方法,经过测试,在3090上是可以正常使用的。
官方给出的安装方法:

pip install torch===1.7.1+cu110 torchvision===0.8.2+cu110 torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

豆瓣源安装:

pip install torch===1.7.1+cu110 torchvision===0.8.2+cu110 torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.douban.com/simple/

在安装过程中,由于连接的是Pytorch的官方地址,所以下载的速度是很慢的,可以手动下载torch包和torchvison的包进行安装,运行一下上面的安装命令,就能看到地址。

pip install torch==2.7.1 torchvision torchaudio -f https://mirrors.aliyun.com/pytorch-wheels/cu128/ pip install torchvision==0.22.1 torchvision torchaudio -f https://mirrors.aliyun.com/pytorch-wheels/cu128/
pip3 install torch==2.4.1 torchvision torchaudio -f https://mirror.sjtu.edu.cn/pytorch-wheels/torch_stable.html
http://www.jsqmd.com/news/483874/

相关文章:

  • 软考高项:第22章:组织通用治理(占分分析/考点/题)
  • JavaScript性能优化实战翱拱
  • 探索Damn Vulnerable Defi Foundry:打造DeFi安全专家之路
  • 动态规划(dp)——完全背包题目
  • C++与Rust交互编程
  • 南大通用(GBase 8s)数据库在 Spring Boot 中使用 Flyway 和 Flowable
  • CN_GreenLumaGUI 项目推荐
  • 探索《最佳数据科学资源》项目:一站式学习与进阶宝典
  • 模板编译期计算
  • 常用windows命令【端口-进程查询、查询包含某个字符串的文件】
  • 如何快速掌握 Skylark in Go:灵活强大的配置语言与脚本引擎全指南
  • Spring Aop失效的情況及解决办法
  • WebLaF高级特性详解:动画效果、自定义皮肤与响应式设计
  • 10个创意案例:用react-nice-avatar打造独特用户头像系统
  • 如何在Windows上测试ip和端口
  • 2026年比较好的碱液屏蔽泵品牌推荐:液冷屏蔽泵用户口碑认可厂家 - 行业平台推荐
  • CN_GreenLumaGUI 项目常见问题解决方案
  • 如何用gh_mirrors/ta/tagger快速实现专业级命名实体识别?3步上手教程
  • Mybatis二级缓存
  • e3nn高级教程:如何自定义具有欧几里得对称性的神经网络层
  • 2026年质量好的自吸式屏蔽泵厂家推荐:氟化氢屏蔽泵/氯甲烷屏蔽泵/管道循环屏蔽泵厂家信誉综合参考 - 品牌宣传支持者
  • 10个Biostar Central项目常见问题的终极解决方案
  • 终极KeyDB社区生态指南:如何成为高效贡献者并掌握沟通技巧
  • 基于PLC变速恒频风电控制系统设计
  • go-mail与主流SMTP服务集成:Gmail、Outlook和SendGrid配置示例
  • 2026年质量好的屏蔽泵厂家推荐:酯肪酸屏蔽泵/二甲醚屏蔽泵/甲苯二甲苯屏蔽泵热门厂家推荐汇总 - 品牌宣传支持者
  • 终极CSS Ratiocinator常见问题解决方案:让你的CSS不再混乱
  • 2026年靠谱的屏蔽泵厂家推荐:液氨屏蔽泵/保温屏蔽泵/无泄漏屏蔽泵厂家实力与用户口碑参考 - 品牌宣传支持者
  • React Stately类型安全终极指南:TypeScript类型定义完整解析
  • Hasura Backend Plus环境变量配置指南:从基础到高级的完整清单