ImportError: cannot import name ‘_update_worker_pids’ from ‘torch._C’

简介: ImportError: cannot import name ‘_update_worker_pids’ from ‘torch._C’

问题描述:

在复现超分辨率算法RNAN(EDSR、RCAN同样的环境)的时候报错,torch要求是0.4.0版本的。

解决方案:

解决方法1(已安装anaconda)

1. 打开命令行(这个自行查找)

2. 新建python的环境 3.6.5(python的版本不能大于3.6)

conda create -n Your_project_name python=3.6.5   # Your_project_name为你的项目名称,自己拟定

3. 进入Your_project_name 项目

conda.bat activate Your_project_name

4. 安装torch(0.4.0版本)

要指定路径安装,不然 version==0.4.0

pip install torch==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html

注:对应上一步骤中torch=0.4.0版本,torchvision得是0.2.0才行,torchvision安装命令如下:

pip install torchvision==0.2.0 -i https://pypi.mirrors.ustc.edu.cn/simple/

解决方法2(未安装anaconda)

1. 如果你的python版本小于3.7,那你就可以不用下载新的python,则你直接进行这一步的操作。(查看自己python的版本可以在命令行输入 python -V)

pip install torch==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html

2. 如果python版本大于3.6,则可以卸载掉或下载新的替换之前版本使用(方法靠个人喜欢),链接参考:https://www.cnblogs.com/sxdcgaq8080/p/10237089.html

然后下载安装新的python3.6.5之后,安装如下包:

pip install torch==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html

参考:解决问题ImportError: cannot import name ‘_update_worker_pids’ from ‘torch._C’_importerror: cannot import name '_update_worker_pi-CSDN博客

目录
相关文章
|
8月前
|
Python
Python报错ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Python报错ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
|
4月前
|
机器学习/深度学习 人工智能
【CatBoost报错解决】CatBoostError: Bad value for num feature[non default doc idx=0,feature idx=19]=
【CatBoost报错解决】CatBoostError: Bad value for num feature[non default doc idx=0,feature idx=19]=
|
数据库
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
634 0
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
AttributeError: module ‘torch.utils‘ has no attribute ‘data‘
属性错误:模块的'torch.utils'没有属性'data'
70 0
|
Python
ImportError: cannot import name '_remove_dead_weakref'
ImportError: cannot import name '_remove_dead_weakref'
225 0
python报错bs4.FeatureNotFound: Couldn‘t find a tree builder with the features you requested: lxml.
python报错bs4.FeatureNotFound: Couldn‘t find a tree builder with the features you requested: lxml.
|
算法框架/工具 Windows
|
Python
from scipy import special, optimize, from ._nnls import nnls ImportError: DLL load failed: 找不到指定的模块。
from scipy import special, optimize, from ._nnls import nnls ImportError: DLL load failed: 找不到指定的模块。
547 0
from scipy import special, optimize, from ._nnls import nnls ImportError: DLL load failed: 找不到指定的模块。
Could not find an NgModule. Use the skip-import option to skip importing in
该错误消息意思是创建Component时未指定其属于哪一个module,因此先用命令行ng g m parent创建一个名为parent的module:
Could not find an NgModule. Use the skip-import option to skip importing in