如何使用conda或pip在Anaconda中安装pytorch? [英] How to install pytorch in Anaconda with conda or pip?
问题描述
我正在尝试在Anaconda中安装pytorch,以便在Windows中使用Python 3.5.按照 pytorch.org 中的说明,我在Anaconda中引入了以下代码:
I am trying to install pytorch in Anaconda to work with Python 3.5 in Windows. Following the instructions in pytorch.org I introduced the following code in Anaconda:
pip3 install torch torchvision
但是出现以下错误:
Command "python setup.py egg_info" failed with error code 1 in C:\Users\sluis\AppData\Local\Temp\pip-install-qmrvz7b9\torch\
通过在网上搜索,我发现这可能是由于setuptools
过期了,但是我检查并对其进行了更新.我也尝试过:
By searching on the web I found out that it may be because of setuptools
being out of date but I checked and have it updated. I also tried:
conda install -c peterjc123 pytorch cuda80
但是会出现以下错误:
The following specifications were found to be in conflict:
- pytorch
Use "conda info <package>" to see the dependencies for each package.
我还尝试加载pytorch的tar.bz2文件,该文件可从以下网站下载:
I also tried to load the pytorch's tar.bz2 file which I download in the following website:
anaconda.org/peterjc123/pytorch/files
然后执行以下操作:
$ conda install filename.tar.bz2
但是我遇到了以下错误:
But I got the following error:
Error: HTTPError: 404 Client Error: None for url: file:///C|/Users/sluis/pytorch-0.3.1-py36_cuda80_cudnn6he774522_2.tar.bz2: file:///C|/Users/sluis/pytorch-0.3.1-py36_cuda80_cudnn6he774522_2.tar.bz2
我对这个编程世界还很陌生,所以我真的不知道如何进一步挖掘错误.有人知道如何安装pytorch吗?
I am quite new to this programming world so I don't really know how to dig more on the errors. Anyone knows how to get pytorch installed?
如我在评论中所建议:
As suggested in the comments I tried:
conda install pytorch torchivsion -c pytorch
然后出现以下错误:
Error: Packages missing in current win-64 channels:
- pytorch
- torchvision
我做到了:
anaconda search -t conda torchvision
并尝试使用以下命令安装dericlk/torchvision
:
And tried to install dericlk/torchvision
using the following command:
conda install -c derickl torchvision
但是我遇到了同样的错误:
But I am getting the same error:
Error: Package missing in current win-64 channels:
- torchvision
我找不到用于win-64的任何torchvision
软件包.
I couldn't find any torchvision
packages for win-64.
conda list
给了我以下内容:
# packages in environment at C:\Users\aaaa\AppData\Local\Continuum\Anaconda3\envs\torchenv2:
#
mkl-include 2018.0.2 1 anaconda
certifi 2016.2.28 py35_0
cffi 1.10.0 py35_0
cmake 3.6.3 vc14_0 [vc14]
openmp 2018.0.0 intel_8 intel
mkl 2017.0.3 0
numpy 1.13.1 py35_0
pip 10.0.0 <pip>
pip 9.0.1 py35_1
pycparser 2.18 py35_0
python 3.5.4 0
pyyaml 3.12 py35_0
setuptools 36.4.0 py35_1
typing 3.6.2 py35_0
vc 14 0
vs2015_runtime 14.0.25420 0
wheel 0.29.0 py35_0
wincertstore 0.2 py35_0
zlib 1.2.11 vc14_0 [vc14]
=======
推荐答案
以下内容对我有用.首先安装MKL
:
The following worked for me. First install MKL
:
conda install -c anaconda mkl
在此之后,安装pytorch和torchvision:
After this, install pytorch and torchvision:
conda install -c pytorch pytorch torchvision
这篇关于如何使用conda或pip在Anaconda中安装pytorch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!