[英]How to make the anaconda plugin use a custom interpreter (virtualenv)?
I want to set the Python interpreter per project basis. 我想为每个项目设置Python解释器。 The docs say: 文档说:
You can of course configure the python interpreter to use in a per-project basis. 您当然可以配置python解释器以在每个项目中使用。 To do that, you have to edit your .sublime-project file and override the python_interpreter user setting there: 为此,您必须编辑.sublime-project文件并在其中覆盖python_interpreter用户设置:
{
// ...
"settings": {
"python_interpreter": "/home/damnwidget/.virtualenvs/mamba-pypy/bin/python"
}
}
This is what i have in my .sublime-project file: 这是我的.sublime-project文件中的内容:
{
"folders":
[
{
"follow_symlinks": true,
"path": "C:\\Users\\Mads\\GoProjects"
},
{
"follow_symlinks": true,
"path": "C:\\Users\\Mads\\PythonProjects"
}
]
}
I've tried many different combinations and i can't make out from the docs, where exactly should that setting go. 我尝试了许多不同的组合,但是我无法从文档中看出该设置的确切位置。
The full layout of a sample .sublime-project
file can be found in the official docs : .sublime-project
文件示例的完整布局可以在官方文档中找到:
{
"folders":
[
{
"path": "src",
"folder_exclude_patterns": ["backup"],
"follow_symlinks": true
},
{
"path": "docs",
"name": "Documentation",
"file_exclude_patterns": ["*.css"]
}
],
"settings":
{
"tab_size": 8
},
"build_systems":
[
{
"name": "List",
"shell_cmd": "ls -l"
}
]
}
So, the "settings"
array should be on the same level as the "folders"
one. 因此, "settings"
数组应与"folders"
数组处于同一级别。 In your case, your file should look like this: 就您而言,您的文件应如下所示:
{
"folders":
[
{
"follow_symlinks": true,
"path": "C:\\Users\\Mads\\GoProjects"
},
{
"follow_symlinks": true,
"path": "C:\\Users\\Mads\\PythonProjects"
}
],
"settings":
{
"python_interpreter": "C:\\Users\\Mads\\.virtualenv\\MyProject\\usr\\bin\\python.exe"
}
}
Obviously, you'll need to set the path to the actual location of your virtualenv's python.exe
file. 显然,您需要将路径设置为virtualenv的python.exe
文件的实际位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.