我正在try 使用PyCharm中的conda环境安装pytorch版本1.6.0.

我查阅了安装相同设备的官方文档.我想用的是中央处理器版本的 torch .因此,我使用了下面粘贴的命令.

conda install pytorch==1.6.0 torchvision==0.7.0 cpuonly -c pytorch

使用此命令,我得到了以下粘贴的响应

Found conflicts! Looking for incompatible packages. 
This can take several minutes.  Press CTRL-C to abort. failed 
                                                                                                                                                                               
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - pytorch==1.6.0 -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.10,<3.11.0a0|>=3.9,<3.10.0a0|>=3.5,<3.6.0a0|>=3.11,<3.12.0a0|3.9.16|3.8.16|3.9.10|3.8.12|3.7.12|3.7.10|3.7.10|3.6.12|3.7.9|3.6.12|3.6.9|3.6.9|3.6.9|3.6.9|3.4.*',build='2_73_pypy|4_73_pypy|5_73_pypy|1_73_pypy|0_73_pypy|0_73_pypy|5_73_pypy|3_73_pypy|1_73_pypy|0_73_pypy']
  - pytorch==1.6.0 -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']
  - torchvision==0.7.0 -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package zlib conflicts for:
torchvision==0.7.0 -> pillow[version='>=4.1.1'] -> zlib[version='1.2.*|1.2.11|1.2.11.*|>=1.2.11,<1.3.0a0|>=1.2.12,<1.3.0a0|1.2.8|>=1.2.13,<1.3.0a0']
python=3.9 -> pypy3.9=7.3.11 -> zlib[version='>=1.2.11,<1.3.0a0|>=1.2.12,<1.3.0a0']

由于这不起作用,我使用pip安装了Torch 1.6.0.(使用以下命令)

pip install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

这也没有起作用,我从我的终端得到了以下响应

ERROR: Could not find a version that satisfies the requirement torch==1.6.0+cpu (from versions: 1.7.1, 1.7.1+cpu, 1.7.1+cu101, 1.7.1+cu110, 1.8.0, 1.8.0+cpu, 1.8.0+cu101, 1.8.0+cu111, 1.8
.1, 1.8.1+cpu, 1.8.1+cu101, 1.8.1+cu102, 1.8.1+cu111, 1.9.0, 1.9.0+cpu, 1.9.0+cu102, 1.9.0+cu111, 1.9.1, 1.9.1+cpu, 1.9.1+cu102, 1.9.1+cu111, 1.10.0, 1.10.0+cpu, 1.10.0+cu102, 1.10.0+cu11, 1.10.0+cu113, 1.10.1, 1.10.1+cpu, 1.10.1+cu102, 1.10.1+cu111, 1.10.1+cu113, 1.10.2, 1.10.2+cpu, 1.10.2+cu102, 1.10.2+cu111, 1.10.2+cu113, 1.11.0, 1.11.0+cpu, 1.11.0+cu113, 1.11.0+cu115, 1.12.0, 1.12.0+cpu, 1.12.0+cu113, 1.12.0+cu116, 1.12.1, 1.12.1+cpu, 1.12.1+cu113, 1.12.1+cu116, 1.13.0, 1.13.0+cpu, 1.13.0+cu116, 1.13.0+cu117, 1.13.1, 1.13.1+cpu, 1.13.1+cu116, 1.13.1+cu117, 2.0.0, 2.0.0+cpu, 2.0.0+cu117, 2.0.0+cu118, 2.0.1, 2.0.1+cpu, 2.0.1+cu117, 2.0.1+cu118)
ERROR: No matching distribution found for torch==1.6.0+cpu

我特别想使用Torch 1.6.0和Torchvision 0.7.0,因为我想要培训的深度学习模型构建在这两个包的指定版本之上.

如何解决此错误?

推荐答案

这是一个Python版本的问题,让我们try 降级,我们将创建一个新的环境与Python3.8,然后安装PyTorchtorchvision里面.

首先,我们创造了我们的环境

conda create -n envname python=3.8

然后我们激活它

conda activate envname

然后我们安装

conda install pytorch==1.6.0 torchvision==0.7.0 cpuonly -c pytorch

记住在之后重新启动PyCharm IDE.

Python相关问答推荐

删除最后一个pip安装的包

处理(潜在)不断增长的任务队列的并行/并行方法

Python 约束无法解决n皇后之谜

Python库:可选地支持numpy类型,而不依赖于numpy

Polars:用氨纶的其他部分替换氨纶的部分

如何在python polars中停止otherate(),当使用when()表达式时?

如何使用它?

NumPy中条件嵌套for循环的向量化

Django RawSQL注释字段

Pandas GroupBy可以分成两个盒子吗?

旋转多边形而不改变内部空间关系

python panda ExcelWriter切换动态公式到数组公式

Python—为什么我的代码返回一个TypeError

无法在Spyder上的Pandas中将本地CSV转换为数据帧

计算机找不到已安装的库'

在第一次调用时使用不同行为的re. sub的最佳方式

遍历列表列表,然后创建数据帧

在不中断格式的情况下在文件的特定部分插入XML标签

当lambda函数作为参数传递时,pyo3执行

了解如何让库认识到我具有所需的依赖项