I am pretty new to using Python with Sublime. Is it possible to install third-party Python libraries for Sublime’s Python interpreter? Or must I stick with using the interpreter installed on my machine?
Don’t mix up the python from sublime with the regular python installation. The python inside sublime is not ment to use as runtime for your own programs.
So yes, you are stucked to the interpreter installed on your machine.
It is possible to install third-party packages to the version of Python used for Sublime Text.
You need to be aware that Sublime Text 2 runs off of Python 2.6. Sublime Text 3 uses Python 3.3. You’ll have to deal with manipulating sys.path to allow the bundled Python to find your packages. Installing packages will be manual also since there is nothing like pip installed in the ST Python.
Hi. My SO is windows, I try to install package (From console in ST3) using pip into python, but package pip not is installed. How i will do it. Please help me. Thanks.
The internal python interpreter of ST does not support pip. Therefore you can’t load/install/use python packages directly.
Copy the library to your package and do relative import
The official way how to add custom python libraries as dependency for others is described at https://packagecontrol.io/docs/dependencies
These are special ST packages which provide ordinary python libraries. If created correctly, Package Control will add the path of that package to the internal python interpreter so you can use it as u are used to by normal import.
possibility 3 (new and still unsupported)
A new way in ST3143+ but no supported one is to copy the desired library into the Data/Lib/python3.3 folder. Files put over there can be used by normal import out of the box, but
- this folder is not handled by Package Control
- there was no way defined yet how Package Control may use that folder in the future.
So you should use that strategy for private use only.
For example, I try to create plugin for SCP transfer files.
I use the paramiko module.
What I need to do ?
from . import paramiko
doesn’t work, but the directory paramiko is in .config/sublime-text-3/Packages/User
Maybe, I can use paramiko from dependencies https://github.com/wbond/package_control_channel/blob/master/repository/dependencies.json
but what if I need another lib which is not in dependencies ?