SystemExit: 2
设计的系统,里面包含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相关推荐
- E SystemExit: 2
问题:查找资料,出现E SystemExit: 2是因为缺少参数,但是参数明明都定义了啊! 解决方法1: 将parser.parse_args()改成 args = parser.parse_args ...
- 解决SystemExit: 2,args = parser.parse_args() 的问题,
报错: File "/home/barry/PycharmProjects/EEPC/detect.py", line 283, in parse_optopt = parser. ...
- Python 标准库之 sys
1. os 与 sys 库的差异 os与sys模块的官方解释如下: os This module provides a portable way of using operating system d ...
- [原]tornado源码分析系列(三)[网络层 IOLoop类]
引言:由于都是在工作当中抽出时间看源代码,所以更新速度比较慢,但是还是希望通过对好的源码的分析和探讨,大家相互学习,发现不好的地方共同讨论. 上次讲了IOLoop中的几个重要的方法,inistance ...
- python异常值删除_python删除有异常值
广告关闭 腾讯云11.11云上盛惠 ,精选热门产品助力上云,云服务器首年88元起,买的越多返的越多,最高返5000元! 开发准备cas 的 python sdk 包含了用于访问和操作 cas 的所有 ...
- python3 ocr_OCR识别-python3.5版
刚接触,啥子都不会,按着教程走 需求:识别图片中的文字信息 环境:windows系统 开发语言:python3.5 使用工具类:1.pyocr 2.PIL 3.tesseract-ocr 步骤: 1. ...
- python中的daemon守护进程实现方法
守护进程是生存期长的一种进程.它们独立于控制终端并且周期性的执行某种任务或等待处理某些发生的事件.他们常常在系统引导装入时启动,在系统关闭时终止. 守护进程的特性 1.在后台运行 2.与其运行前的环境 ...
- python高级-模块(14)
一.python中的模块 有过C语言编程经验的朋友都知道在C语言中如果要引用sqrt函数,必须用语句#include <math.h>引入math.h这个头文件,否则是无法正常进行调用的. ...
- Python中线程Timeout的使用
Python中关于Timeout有另一种用起来更简便的方法,即使用装饰器.这种方式是使用sys模块的settrace等方法重构了python的threading类: #!/usr/bin/python ...
- Python培训分享:Python内置标准异常及其解析
本期小编为大家带来的Python培训教程是关于"Python内置标准异常及其解析"的内容,我们都知道,在Python技术运作下,总会出现一些Python无法正常处理的程序时就会发生 ...
最新文章
- mysql中检索以名字_【MySQL必知必会】第四章 检索数据
- 《Linux命令行与shell脚本编程大全 第3版》Shell脚本编程基础---02
- maven环境快速搭建
- BZOJ3996 [TJOI2015]线性代数 【最小割】
- ASP删除黑客建立的只读文件夹和文件
- Sencha Touch 搭建命令
- c# 读取 txt 文件中数据(int)
- 设计模式的七大设计原则:其七:合成复用原则
- oracle plsql 字符串长度,PLSQL SQL
- 再见2018,你好2019
- v4l2接口,结构图
- yosemite php gd,Yosemite/El Capitan php-gd mcrypt安装
- 网页跳转代码的三种方法
- Java Web项目源码整合开发大合集
- idea更新报错:master has no tracked branch
- 互联网发展的三个阶段
- 用matlab表白,用函数表达对她的爱
- 开心赚手机网赚操作真实赚钱项目揭秘
- 【Code】Python金字塔模型的实现(Pyramid)
- fmri|SPM contrast manager