在VS Code中设置本地项目的Python路径而不使用settings.json文件
此答案说,保持Visual Studio Code项目的 settings.json 文件,可在不同的开发环境中实施代码标准。缺点是,当我在屏幕底部选择Python解释器路径时(这样,lint可以找到已安装的软件包),以下条目将添加到 settings.json
文件:
This answer from a Visual Studio Code developer says that it is reasonable to keep a Visual Studio Code project's settings.json
file in a project's git repository to enforce code standards across different development environments. One down-side though is that when I select the Python interpreter path at the bottom of the screen (so the linter can find the installed packages), the following entry gets added to the settings.json
file:
"python.pythonPath": "/path/to/conda/envs/my-env-name/bin/python",
此路径是机器本地的,并假定使用了conda 。我必须避免将此设置添加到我提交到git存储库的 settings.json
中,这很烦人。
This path is local to the machine and assumes that conda is being used. I have to avoid adding this setting to the settings.json
that I commit to the git repository, which is annoying.
是否可以在不将设置写入 settings.json
文件的情况下为项目在本地设置Python路径?
Is there a way to set the Python path locally for a project without writing a setting into the settings.json
file?
当前不直接支持,但我们有功能请求,如果您希望优先处理该请求,则可以对其进行投票。
It currently isn't directly supported, but we have a feature request that you can upvote if you would like to see it prioritized.