python - 进程以退出代码 2 结束
问题描述
每当我尝试在 pycharm 中运行对象检测程序时,都会发生以下错误(请参阅跟踪)。你能帮忙弄清楚,如何解决它?
C:\Users\Dell\venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 11093 --file C:/Users/Dell/Desktop/image.py
pydev debugger: process 2648 is connecting
Connected to pydev debugger (build 183.5429.31)
usage: image.py [-h] -i IMAGE -p PROTOTXT -m MODEL [-c CONFIDENCE]
image.py: error: the following arguments are required: -i/--image, -p/--prototxt, -m/--model
Process finished with exit code 2
实际上我正在尝试在下一页中运行代码
https://www.pyimagesearch.com/2017/09/11/object-detection-with-deep-learning-and-opencv/ 我的问题是我应该在哪里复制和粘贴......python deep_learning_object_detection.py \ --prototxt MobileNetSSD_deploy.prototxt.txt \ --model MobileNetSSD_deploy.caffemodel --image images/example_01.jpg
解决方案
在 PyCharm 的Run
菜单中,查找Edit configurations...
每次运行新脚本时,都会为其创建运行配置,您可以在此处在Parameters:
框中提供命令行参数。
您可能只想在此处传递参数部分,而不是脚本名称,因此:
\ --prototxt MobileNetSSD_deploy.prototxt.txt \ --model MobileNetSSD_deploy.caffemodel --image images/example_01.jpg
您可能遇到的另一个问题是您的脚本需要在哪个工作目录中运行。您可以从同一个对话框中更改它,位于Working directory:
. 您会发现您很少需要更改此对话框中的任何其他字段,尽管我建议在下面给它一个对您来说合理的名称Name:
- 默认情况下,它以它正在运行的脚本文件命名。
推荐阅读
- python - 在文本文件中使用特定行
- php - How to create temporary files in php to send them by email?
- flutter - 我正在制作一个自定义小部件,我该如何使用它?
- css - 如何为垂直滑块定位 ngx-slider 句柄?
- android - 如何将抽屉活动创建为多个其他活动的基本活动
- kubernetes - NextJS process.env.NEXT_PUBLIC 变量在生产中为空
- javascript - 在按钮上单击使用 JavaScript、角度或节点 JS 在热敏打印机上打印
- html - Angular 在按钮单击时更改行的颜色
- c++ - 如何将参数传递给C++中的回调函数?
- amazon-web-services - AWS ECS 计划任务在创建后未执行