@[小粽子~的第一篇博客]
新的环境,想要安装pytorch就是安装不好,参考了很多优秀博主的方法,比如:https://blog.csdn.net/u014723479/article/details/103001861
https://blog.csdn.net/qq_38704904/article/details/95192856
以下省略N个博客。。。。。
但都不适合我,排除了网络的问题,依旧出现以下错误:
ERROR: Could not find a version that satisfies the requirement torch=1.6.0 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch=1.6.0
试了网上各种博客中的方法都没办法解决这个问题,肿么肥四,都快要放弃了。最后在github上面找到了解决方案,可以参考https://github.com/pytorch/pytorch/issues/10443,我选择了采用了这个方法完美解决了问题
代码如下:
conda install pytorch=0.4.1 -c pytorch
终于看见它有反应,开森ing~解决效果:
最后我们用以下测试一下
import torch
print(torch.__version__)
print(torch.cuda.is_available())#cuda是否可用
torch.cuda.device_count()#返回GPU的数量
torch.cuda.get_device_name(0)#返回gpu名字,设备索引默认从0开始
下面展
出现以下内容就说明成功啦~~Ps:在输入最后一行代码的时候不小心压到键盘,乱糟糟的就不显示了
安装好的童鞋接下来就好好学习代码吧~
祝你们有个愉快的学习体验~
第一次写博客,表达的不够好的话,可以回到本博客最上面,参考其他博主内容,谢谢大家O(∩_∩)O哈哈~