信息:
议程:
确保python -c "import torch"
正常运行。
过程:
我已经使用conda create -n myenv
在此之后,我非常困难地进一步安装了conda install pytorch torchvision cudatoolkit -c pytorch
执行上述命令时,由于HTTPRequest失败,该命令被中途中断
在几次此类失败之后,我使用conda install pytorch -c pytorch
当我输入python -c "import torch"
时,出现如下所示的OSError
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\sanpj\.conda\envs\myenv\lib\site-packages\torch\__init__.py", line 42, in <module>
import numpy as _np # noqa: F401
File "C:\Users\sanpj\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\Users\sanpj\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 23, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\sanpj\.conda\envs\myenv\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
但是输出不应该是这样。
当我输入python
时,我得到一些如下所述的信息
Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
答案 0 :(得分:0)
解决了!
实际上,我也将火炬,torchvision和numpy的版本降级了。 确实解决了这个问题。