如何指定非标准的 Python 解释器? [英] How to specify non-standard Python interpreter?
问题描述
我的应用程序有内置的 Python 解释器,我需要在那里调试 Python 代码.但是,Visual Studio Code 只允许从在路径中找到并命名为 python/python2/python3 的解释器中进行选择.
My application has built-in Python interpreter and I need to debug Python code there. However Visual Studio Code allows to choose only from interpreters found in paths and named python/python2/python3.
我尝试将 settings.json 中的 python.pythonPath 设置为指向我的应用程序,但 Visual Studio Code 无法将其识别为有效的 Python 解释器.
I tried to set python.pythonPath in settings.json to point to my application, but Visual Studio Code doesn't recognize it as valid Python interpreter.
当然,我需要确保我的应用程序的行为类似于 Python 解释器,并将所有命令行参数传递给 Python ptvsd_launcher.py.
Sure, I need to make sure that my application behave like Python interpreter and pass all command-line parameters to Python ptvsd_launcher.py.
推荐答案
"python.pythonPath"
设置用于指定不会自动检测到的 Python 解释器.如果二进制文件不能作为普通的 python
二进制文件运行,那么不幸的是,扩展程序无法使用它.
The "python.pythonPath"
setting is how you can specify a Python interpreter that is not automatically detected. If the binary does not function as a normal python
binary then unfortunately there's no way for the extension to use it.
这篇关于如何指定非标准的 Python 解释器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!