[英]How do I configure a Python interpreter in IntelliJ IDEA with the PyCharm plugin?
[英]How do I disable -u interpreter option in PyCharm?
我正在配置 PyCharm 以使用遠程 python 解釋器。 PyCharm 似乎使用 -u 選項執行解釋器,但我找不到禁用它的方法。 我需要禁用它的原因是我正在運行nosetests
命令,所以我得到了這個:
ssh://xxx@xxx.xxx.xxx.xxx:22/path/to/bin/nosetests -s -a M_4439 -u /path/to/test_elf.py
Usage: nosetests [options]
nosetests: error: no such option: -u
Process finished with exit code 2
我環顧四周,找不到-u
的設置位置。 我檢查了:
-s -a M_4439
-u
在哪里設置?
我發現如果你首先在“解釋器選項”中傳遞-u
然后它將該參數傳遞給解釋器(python)而不是庫,所以我發現/opt/conda/bin/python -u -m torch.distributed.launch --nproc_per_node=4 your_script.py
有效,而/opt/conda/bin/python -m torch.distributed.launch --nproc_per_node=4 -u your_script.py
無效。
請注意,如果您顯式傳遞-u
,則稍后不會在命令中再次添加它。
根據上面的評論回答我自己的問題:
PyCharm 有它的幫助腳本來運行鼻子測試。 我將解釋器配置為遠程 python,現在我得到了這個(這是我需要的):ssh://xxx@xxx.xxx.xxx.xxx:22/path/to/bin/python -u /path/to /.pycharm_helpers/pycharm/noserunner.py /path/to/test_elf.py 。
現在我只需要找出通常來自 .bashrc 的預測試腳本。 編輯配置 -> 啟動前:遠程外部工具執行此操作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.