admin管理员组

文章数量:1642449

问题描述

在项目中安装其他的库之后,运行项目忽然报这个错:

ImportError: Failed to load PyTorch C extensions:
		It apperas that PyTorch has loaded the `torch/_C` folder
		of the PyTorch repository rather than the C extensions which
		are expected in the `torch._C` namespace. This can occur when
		using the `install` workflow. e.g.
			  $ python setup.py install && python -c "import torch"

		This error can generally be solved using `develop` workflow
			  $ python setup.py develop && python -c "import torchi" # This should succeed
		or by running Python from a different directory.

Process finished with exit code 1

解决办法

在项目里重装 torch库就好了。

pip uninstall torch==1.10.2
pip install torch==1.10.2

本文标签: failedImportErrorloadExtensionsPytorch