设计的系统,里面包含yolov5模块,其中args.parser,parse_args()负责解析终端里面输入的参数。后端主函数能完美运行的程序,放到django前端就不能执行。

Traceback (most recent call last):File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/wsgiref/handlers.py", line 137, in runself.result = application(self.environ, self.start_response)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/contrib/staticfiles/handlers.py", line 80, in __call__return self.application(environ, start_response)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 132, in __call__response = self.get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/base.py", line 140, in get_responseresponse = self._middleware_chain(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in innerresponse = get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/utils/deprecation.py", line 134, in __call__response = response or self.get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in innerresponse = get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/utils/deprecation.py", line 134, in __call__response = response or self.get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in innerresponse = get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/utils/deprecation.py", line 134, in __call__response = response or self.get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in innerresponse = get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/utils/deprecation.py", line 134, in __call__response = response or self.get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in innerresponse = get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/utils/deprecation.py", line 134, in __call__response = response or self.get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in innerresponse = get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/utils/deprecation.py", line 134, in __call__response = response or self.get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in innerresponse = get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/utils/deprecation.py", line 134, in __call__response = response or self.get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in innerresponse = get_response(request)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_responseresponse = wrapped_callback(request, *callback_args, **callback_kwargs)File "/home/barry/PycharmProjects/EEPC/login/views.py", line 148, in results = Deal_Score(file_list,ma,mi)File "/home/barry/PycharmProjects/EEPC/main.py", line 229, in Deal_Scoredeal(image_one)File "/home/barry/PycharmProjects/EEPC/main.py", line 143, in dealchoice_score = choice_question(choice_src)File "/home/barry/PycharmProjects/EEPC/detect.py", line 315, in choice_questionresult = Detect(p)File "/home/barry/PycharmProjects/EEPC/detect.py", line 297, in Detectopt = parse_opt()File "/home/barry/PycharmProjects/EEPC/detect.py", line 283, in parse_optopt = parser.parse_args()File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/argparse.py", line 1823, in parse_argsself.error(msg % ' '.join(argv))File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/argparse.py", line 2577, in errorself.exit(2, _('%(prog)s: error: %(message)s\n') % args)File "/home/barry/anaconda3/envs/EEPC/lib/python3.9/argparse.py", line 2564, in exit_sys.exit(status)
SystemExit: 2

核心就是最后一行SystemExit: 2

解决方案:

args = parser.parse_args()
改成
args = parser.parse_args(args=[])

SystemExit: 2相关推荐

  1. E SystemExit: 2

    问题:查找资料,出现E SystemExit: 2是因为缺少参数,但是参数明明都定义了啊! 解决方法1: 将parser.parse_args()改成 args = parser.parse_args ...

  2. 解决SystemExit: 2,args = parser.parse_args() 的问题,

    报错: File "/home/barry/PycharmProjects/EEPC/detect.py", line 283, in parse_optopt = parser. ...

  3. Python 标准库之 sys

    1. os 与 sys 库的差异 os与sys模块的官方解释如下: os This module provides a portable way of using operating system d ...

  4. [原]tornado源码分析系列(三)[网络层 IOLoop类]

    引言:由于都是在工作当中抽出时间看源代码,所以更新速度比较慢,但是还是希望通过对好的源码的分析和探讨,大家相互学习,发现不好的地方共同讨论. 上次讲了IOLoop中的几个重要的方法,inistance ...

  5. python异常值删除_python删除有异常值

    广告关闭 腾讯云11.11云上盛惠 ,精选热门产品助力上云,云服务器首年88元起,买的越多返的越多,最高返5000元! 开发准备cas 的 python sdk 包含了用于访问和操作 cas 的所有 ...

  6. python3 ocr_OCR识别-python3.5版

    刚接触,啥子都不会,按着教程走 需求:识别图片中的文字信息 环境:windows系统 开发语言:python3.5 使用工具类:1.pyocr 2.PIL 3.tesseract-ocr 步骤: 1. ...

  7. python中的daemon守护进程实现方法

    守护进程是生存期长的一种进程.它们独立于控制终端并且周期性的执行某种任务或等待处理某些发生的事件.他们常常在系统引导装入时启动,在系统关闭时终止. 守护进程的特性 1.在后台运行 2.与其运行前的环境 ...

  8. python高级-模块(14)

    一.python中的模块 有过C语言编程经验的朋友都知道在C语言中如果要引用sqrt函数,必须用语句#include <math.h>引入math.h这个头文件,否则是无法正常进行调用的. ...

  9. Python中线程Timeout的使用

    Python中关于Timeout有另一种用起来更简便的方法,即使用装饰器.这种方式是使用sys模块的settrace等方法重构了python的threading类: #!/usr/bin/python ...

  10. Python培训分享:Python内置标准异常及其解析

    本期小编为大家带来的Python培训教程是关于"Python内置标准异常及其解析"的内容,我们都知道,在Python技术运作下,总会出现一些Python无法正常处理的程序时就会发生 ...

最新文章

  1. mysql中检索以名字_【MySQL必知必会】第四章 检索数据
  2. 《Linux命令行与shell脚本编程大全 第3版》Shell脚本编程基础---02
  3. maven环境快速搭建
  4. BZOJ3996 [TJOI2015]线性代数 【最小割】
  5. ASP删除黑客建立的只读文件夹和文件
  6. Sencha Touch 搭建命令
  7. c# 读取 txt 文件中数据(int)
  8. 设计模式的七大设计原则:其七:合成复用原则
  9. oracle plsql 字符串长度,PLSQL SQL
  10. 再见2018,你好2019
  11. v4l2接口,结构图
  12. yosemite php gd,Yosemite/El Capitan php-gd mcrypt安装
  13. 网页跳转代码的三种方法
  14. Java Web项目源码整合开发大合集
  15. idea更新报错:master has no tracked branch
  16. 互联网发展的三个阶段
  17. 用matlab表白,用函数表达对她的爱
  18. 开心赚手机网赚操作真实赚钱项目揭秘
  19. 【Code】Python金字塔模型的实现(Pyramid)
  20. fmri|SPM contrast manager

热门文章

  1. EqualLogic全攻略视频[(五)网络优化]
  2. [蛋蛋插画日记]喂喂,看“表演”请砸钱币喔!
  3. SQLite适用的范围
  4. 【Webcam设计】利用底层V4L2+OPENCV进行图像处理以及移植策略
  5. Java中的管程Monitor
  6. CNN for Sentence Classification-textcnn阅读笔记
  7. 同一台电脑管理多个`SSH KEY`
  8. 百度富文本编辑器去掉自动保存功能
  9. struts2登陆拦截器
  10. 一次Mysql 死锁事故