Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Sublime Text, how to use Anaconda Python instead of default

How do I go about setting sublime text to build with my anaconda python and not the default one? I have pyaudio installed in anaconda but when I build my page in sublime it says no module of pyaudio found. I assume it is because it is building with the default python.

I have installed conda in the sublime package manager too and it says I am pointed to my anaconda python, still not working though.

like image 405
KevinM1990112qwq Avatar asked Nov 27 '25 11:11

KevinM1990112qwq


1 Answers

So I looked at the docs and tried it out, so this should work for you.

From within Sublime Text 3 navigate to 'Tools'>'Build System'>'New Build System'

Then, configure your build system file similar to this (note our directories may differ):

{
  "cmd": ["C:\\ProgramData\\Anaconda3\\python.exe", "$file"],
  "selector": "source.python"
}

save it and name it something appropriate like 'anaconda_custom.sublime-build'

then open your python file and execute the Ctrl-Shift-B command to select the build option 'anaconda_custom' to build using the conda python.exe.

I haven't tested to see if this changes the default build for python but at least you have a pathway to execution with the conda python.exe. There is probably a setting for that somewhere.

Also, if you haven't already tried it, I recommend VSCode with the Kite extension installed for coding in Python. I sometime use Sublime Text too but VSCode has become my new favourite.

I hope this helps.

like image 79
John Forbes Avatar answered Nov 29 '25 00:11

John Forbes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!