【问题标题】:How to pass "-v" argument for Python in PyCharm IDE如何在 PyCharm IDE 中为 Python 传递“-v”参数
【发布时间】:2017-01-16 11:19:31
【问题描述】:

我想在 PyCharm IDE 中以详细模式运行 Python 程序。我在运行/调试配置窗口下的解释器选项中指定了"-v"。但它显示以下错误:

/usr/bin/python2.7
/home/user1/Downloads/pycharm-community-2016.1.4/helpers/pydev/pydev_run_in_console.py
35261 34268 -v
/home/user1/my_codings/gitStuffs/Cura_Debian_Release/usr/share/cura/cura.py
Traceback (most recent call last):   File
"/home/user1/Downloads/pycharm-community-2016.1.4/helpers/pydev/pydev_run_in_console.py",
line 71, in <module>
    globals = run_file(file, None, None)   File "/home/user1/Downloads/pycharm-community-2016.1.4/helpers/pydev/pydev_run_in_console.py",
line 31, in run_file
    pydev_imports.execfile(file, globals, locals)  # execute the script IOError: [Errno 2] No such file or directory: '-v' Running -v

【问题讨论】:

    标签: python pycharm


    【解决方案1】:

    如果你像这样运行它应该可以工作:

    /usr/bin/python2.7 -v /home/user1/my_codings/gitStuffs/Cura_Debian_Release/usr/share/cura/cura.py
    

    如果您需要调试器(或添加其他文件),那么 -v 应该首先使用:

    /usr/bin/python2.7 -v /home/user1/Downloads/pycharm-community-2016.1.4/helpers/pydev/pydev_run_in_console.py 35261 34268 /home/user1/my_codings/gitStuffs/Cura_Debian_Release/usr/share/cura/cura.py
    

    在 PyCharm 中,您应该在 Interpreter options 中添加 -v /home/user1/Downloads/pycharm-community-2016.1.4/helpers/pydev/pydev_run_in_console.py 35261 34268

    【讨论】:

    • 感谢您的回答。但我想从 pyCharm 本身来做。我需要知道可以放置 -v 的位置
    • @PraveenMax 请编辑您的问题并从运行/调试配置中添加信息。尤其是 Script parametersInterpreter options 中的内容。
    猜你喜欢
    • 2015-10-31
    • 2021-10-08
    • 1970-01-01
    • 2020-03-07
    • 1970-01-01
    • 2010-10-16
    • 2011-09-12
    • 2020-03-03
    相关资源
    最近更新 更多