【发布时间】:2018-10-02 19:41:00
【问题描述】:
我已经尝试安装 PyTorch 和 TorchVision 一段时间来帮助我正在做的一些神经网络/机器学习项目。
我的问题是我似乎无法让安装工作,无论是在 PyCharm pip、Anaconda 提示符还是 cmd/使用 pip3 命令。
尝试通过 PyCharm 运行以下命令时得到的输出:
pip install --user pytorch==0.1.2
这是:
Collecting pytorch
Using cached https://files.pythonhosted.org/packages/a9/41/4487bc23e3ac4d674943176f5aa309427b011e00607eb98899e9d951f67b/pytorch-0.1.2.tar.gz
Building wheels for collected packages: pytorch
Running setup.py bdist_wheel for pytorch: started
Running setup.py bdist_wheel for pytorch: finished with status 'error'
Complete output from command C:\Users\Even\Anaconda3\envs\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Even\\AppData\\Local\\Temp\\pycharm-packaging\\pytorch\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Even\AppData\Local\Temp\pip-wheel-2sfgqmm7 --python-tag cp36:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Even\AppData\Local\Temp\pycharm-packaging\pytorch\setup.py", line 17, in <module>
raise Exception(message)
Exception: You should install pytorch from http://pytorch.org
----------------------------------------
Running setup.py clean for pytorch
Failed to build pytorch
Installing collected packages: pytorch
Running setup.py install for pytorch: started
Running setup.py install for pytorch: finished with status 'error'
Complete output from command C:\Users\Even\Anaconda3\envs\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Even\\AppData\\Local\\Temp\\pycharm-packaging\\pytorch\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Even\AppData\Local\Temp\pip-record-1jx5e1ke\install-record.txt --single-version-externally-managed --compile --user --prefix=:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Even\AppData\Local\Temp\pycharm-packaging\pytorch\setup.py", line 13, in <module>
raise Exception(message)
Exception: You should install pytorch from http://pytorch.org
----------------------------------------
Failed building wheel for pytorch
Command "C:\Users\Even\Anaconda3\envs\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Even\\AppData\\Local\\Temp\\pycharm-packaging\\pytorch\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Even\AppData\Local\Temp\pip-record-1jx5e1ke\install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in C:\Users\Even\AppData\Local\Temp\pycharm-packaging\pytorch\
我也试过这个命令(CMD):
pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-
win_amd64.whl
在此输出中返回的内容:
torch-0.4.1-cp36-cp36m-win_amd64.whl is not a supported wheel on this
platform.
我可能遗漏了一些重要信息,但我一直在谷歌搜索、搜索论坛并询问我认识的人。没有人有答案。我希望你们中的一些人可能遇到过同样的问题。
谢谢。
【问题讨论】:
-
pip3 -V/python3 -V/python3 -c "from pip._internal import pep425tags; print(pep425tags.get_platform())"的输出是什么? -
pip3 -V给出pip 18.0 from C:\Users\Even\AppData\Roaming\Python\Python36\site-packages\pip (python 3.6)。 -
python -V给出Python 3.6.5(python3 似乎不起作用。我在 Windows 上,如果相关的话) -
最后一个给
win32。 @hoefling -
PyTorch 不适用于 32 位系统。请使用 Windows 和 Python 64 位版本。
标签: python-3.x pip pycharm pytorch