問題描述
使用 Sublime Text 3,如何使用我在 http://conda.pydata.org/docs/using/envs.html
Using Sublime Text 3, how can I build a python file using a conda environment that I've created as in http://conda.pydata.org/docs/using/envs.html
推薦答案
注意:這將適用于使用 conda
以及 創建的虛擬環境>venv
或 virtualenv
,您只需先激活它即可找到 python[3]
可執行文件的路徑.
NOTE: This will work for virtual environments created with conda
as well as venv
or virtualenv
, you just need to activate it first to find the path to the python[3]
executable.
一個標準的 Python .sublime-build
文件如下所示:
A standard Python .sublime-build
file looks like this:
{
"cmd": ["/path/to/python", "-u", "$file"],
"file_regex": "^[ ]*File "(...*?)", line ([0-9]*)",
"selector": "source.python"
}
使用特定 conda
環境所需要做的就是修改環境中 python
或 python3
可執行文件的路徑.要找到它,請激活您的環境并輸入(取決于您使用的版本)
All you need to do to use a particular conda
environment is modify the path to the python
or python3
executable within the environment. To find it, activate your environment and type (depending on the version you're using)
which python
或
which python3
在 Linux/macOS 上,或
on Linux/macOS, or
where python
在 Windows 上,然后將路徑復制到您的自定義 .sublime-build
文件中.將文件保存在 Packages/User
目錄中,然后確保通過 Tools -> 選擇正確的文件.在構建之前構建系統
.
on Windows, then copy the path into your custom .sublime-build
file. Save the file in your Packages/User
directory, then make sure you pick the right one via Tools -> Build System
before building.
這篇關于在 sublime text 3 中使用 conda 環境的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!