解决方法:

1.去掉num_workers参数(或者将num_workers=0)

你直接crtl+shift+F全局搜索num_workers,然后让它等于0就可以解决

2.在跑epoch之前,加上if __name__=='__main__':

可以看到我的控制台提示在test.py的for这里出错,那么此时我就加入if __name__=='__main__':,然后将for的代码块放进去

修改好的样子:

An attempt has been made to start a new process before the current process相关推荐

  1. python 多线程报错An attempt has been made to start a new process before the current process has finished

    报错信息: An attempt has been made to start a new process before the current process has finished its 原因 ...

  2. An attempt has been made to start a new process before the current process has finished its

    必须在 if __name__=='__main__': 后运行

  3. RuntimeError: An attempt has been made to start a new process before the current pr

    pytorch 加载数据时报错: RuntimeError:          An attempt has been made to start a new process before the   ...

  4. python多进程原理_python多进程的详细介绍(附示例)

    本篇文章给大家带来的内容是关于PHP中的SAPI是什么?如何实现?(图文),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 进程 Python是运行在解释器中的语言,查找资料知道,py ...

  5. 医学数据挖掘学习项目:他克莫司

    目录 1. 报告 2. 代码1:从数据库中提取数据 lambda,匿名函数,快速定义单行函数,可以用在任何需要函数的地方. numpy.array 和 python.array python.filt ...

  6. python大佬养成计划-----多进程

    进程 Python是运行在解释器中的语言,查找资料知道,python中有一个全局锁(GIL),在使用多进程(Thread)的情况下,不能发挥多核的优势.而使用多进程(Multiprocess),则可以 ...

  7. dataloader 源码_[莫烦 PyTorch 系列教程] 3.5 – 数据读取 (Data Loader)

    请教一个问题: 在遍历"for step, (batch_x, batch_y) in enumerate(loader): "这一步会报这样的错误: raceback (most ...

  8. cobalt strike profile

    cobalt strike 配置解读 此处以最新版 jquery-c2.4.3.profile文件解析 适应Cobalt Strike 4.3 版本 其他版本会有标注 cobalt strike 4. ...

  9. Pytorch报错:“freeze_support()“ line can be omitted if the program is not going to be frozen(已解决)

    报错提示: 运行 pytoch 测试代码时,出现如下报错: model [TestModel] was created liu yaxin 21 Traceback (most recent call ...

最新文章

  1. python如何导入txt文件-数据从txt文本导入python
  2. 一文看透 Redis 分布式锁进化史(解读 + 缺陷分析)
  3. 禁用mysql的sleep函数_MySQL的sleep函数的特殊特现象
  4. 使用Google Custom Search打造站内搜索
  5. Java多线程编程系列-多线程基础
  6. 毕业设计(三)---spring学习笔记(1)之-IOC
  7. 优秀的电商平台Jshop栗子
  8. 自己理解的比特币双重支付
  9. Feature Extraction
  10. 详解MySQL双活同步复制四种解决方案
  11. [UIImage _isCached]: message sent to deallocated instance
  12. linux安装apache+php+mysql_linux编译安装Apache+PHP+Mysql
  13. 数据模型、概念模型、逻辑模型、物理模型
  14. python量化投资推荐书籍_有没有值得推荐的介绍有名的量化投资策略的书籍?
  15. c 语言 控制台程序 行字体颜色,C# 控制台程序设置字体颜色
  16. caffe常用层:特殊的Math函数
  17. 爬取虎扑社区,存入MongoDB数据库
  18. 基于java(springboot)校园新闻管理系统源码(java毕业设计)
  19. 弄懂到底啥是-IOS
  20. OBS斗鱼直播弹幕插件效果

热门文章

  1. ORACLE10G导入11G导出的文件
  2. Kubernetes中使用CronJob定时备份etcd集群数据
  3. day-16 jquery的DOM文档操作及bootstrap
  4. 9.特殊权限 软连接 硬链接
  5. JavaScript 5/30:Flex Panel Gallery即FLEX布局的图片库
  6. PDF阅读器中如何改变线条颜色、线宽和线型等
  7. IDC:物联网计划对IT基础设施影响重大
  8. [C/C++标准库]_[0基础]_[怎样实现std::string自己的Format(sprintf)函数]
  9. 关于推荐的一个算法工程师访谈,有一些内容值得看看
  10. Zend Studio使用教程:序列号注册