无法在Sublime Text 3中使用Ananconda解释器
我想将Sublime Text 3用作我的Python编辑器,但无法弄清楚如何使Anaconda成为Python的默认解释器.为了确保将Anaconda正确添加到路径,请在我键入的终端中
I want to use Sublime Text 3 as my Python editor but cannot figure out how to make Anaconda its default interpreter for Python. To make sure that Anaconda is added to the path correctly, in the terminal I typed
$哪个python
$ which python
终端退货
/home/rahit/anaconda3/bin/python
/home/rahit/anaconda3/bin/python
但是当我在ST 3中键入这样的代码时
But when I type a code like this in ST 3
import sys
print(sys.executable)
Sublime控制台中的输出将为
The output in the Sublime console will be
/usr/bin/python
/usr/bin/python
现在,如果我键入
将熊猫作为pd导入
总会有错误
ImportError:没有名为pandas的模块[在0.0秒内完成,退出代码为1][shell_cmd:python -u"/home/rahit/Documents/Python/pro.py"][dir:/home/rahit/Documents/Python][路径:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/> usr/local/games:/opt/jdk-11.0.2/bin]`
ImportError: No module named pandas [Finished in 0.0s with exit code 1] [shell_cmd: python -u "/home/rahit/Documents/Python/pro.py"] [dir: /home/rahit/Documents/Python] [path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/> usr/local/games:/opt/jdk-11.0.2/bin]`
除了这些,每当我启动Sublime Text 3时,很多时候我都会收到一条消息,说
Apart from these whenever I launch Sublime Text 3, many a times I get a message saying
< Anaconda.anaconda_lib.workers.local_process.LocalProcess对象位于0x7f248c4eab90>进程无法在操作系统中启动新的anaconda JsonServer,因为:
Anaconda无法使用您当前配置的python解释器(/home/rahit/anaconda/bin/python)产生新进程确保您的解释器是有效的二进制文件,并且位于PATH中,或使用指向它的绝对路径,例如:/usr/bin/python
我已经看到有关这些主题的一些问题,但没有一个实际上解决了我的问题.我还在github上看到人们进行了类似的讨论,最后我得出结论,康达不能与ST3一起使用.最后一次,我只想知道是否有任何方法可以解决此问题,因为我真的想对Python使用ST3.
I have seen there are already some questions asked on these topic but none of them actually solved my problem. I have also seen people similar discussions on github from which I have ended up concluding that Conda cannot be used with ST3. For the final time I just want to know if there is any way to fix this problem cause I really want to use ST3 for Python.
那是因为sublime使用的构建系统,它使用了默认的python可执行文件.
That is because of the build system that sublime uses, it uses your default python executable.
如果转到工具▶构建系统▶新建构建系统…,然后您可以定义自己的使用anaconda可执行文件的构建系统.看起来应该像下面的
If you go to Tools ▶ Build System ▶ New Build System… and then you can define your own build system that uses the anaconda executable. It should look like the following
{
'cmd': ['/usr/bin/python3', '-u', '$file'],
'file_regex': '^[ ]*File "(…*?)", line ([0-9]*)',
'selector': 'source.python'
}
然后将路径替换为anaconda可执行文件的路径
Then just replace the path with the path of your anaconda executable