How to use "pip" with Pythonscript plugin?
-
If you want to use a Python module that isn’t part of the Pythonscript plugin out of the box, what’s the method for getting it installed? I’m sure it involves
pip
but I don’t know the details.For instance, if I wanted to install the “camelcase” module into my Pythonscript environment, how can I do it so that
import camelcase
succeeds? -
The only way I see currently is to install python 2.7 locally and use pip to install the library.
Change the setting to prefer local installation from PS config dialog -
I found this README.txt at “c:\Program Files (x86)\Notepad++\plugins\PythonScript\lib\site-packages\README.txt” and it says:
“”"
This directory exists so that 3rd party packages can be installed
here. Read the source for site.py for more details.
“”"
Copy packages from another python 2.7 virtual environment to the above directory should work. -
I use the 3.0.7-alpha version of PythonScript and I do not have the aforementioned config checkbox checked. I installed the minimal version meaning it has the Npp libraries and not much else. I don’t think I have anything special setup in my
startup.py
, it just seems to find all my system Python modules. In fact, from the PythonScript console:>>> for p in sys.path: print(p) ... C:\usr\bin\npp64\plugins\PythonScript\lib C:\usr\bin\npp64\plugins\Config\PythonScript\lib C:\usr\bin\npp64\plugins\PythonScript\scripts C:\usr\bin\npp64\plugins\Config\PythonScript\scripts C:\usr\bin\npp64\plugins\PythonScript\lib\lib-tk C:\usr\bin\npp64\plugins\PythonScript\python38.zip C:\Python3\Lib C:\Python3\DLLs C:\usr\bin\npp64 C:\Users\VinsWorldcom\AppData\Roaming\Python\Python38\site-packages C:\Users\VinsWorldcom\AppData\Roaming\Python\Python38\site-packages\win32 C:\Users\VinsWorldcom\AppData\Roaming\Python\Python38\site-packages\win32\lib C:\Users\VinsWorldcom\AppData\Roaming\Python\Python38\site-packages\Pythonwin C:\Python3 C:\Python3\lib\site-packages
Is that normal? Because I like this behavior - means I just install stuff in my system Python and I can use it normally as well as in Npp scripts. Makes the simple Python IDE thing Eko gave us a while back and I’ve been tweaking since work very nicely!
Cheers.
-
@michael-vincent said in How to use "pip" with Pythonscript plugin?:
the simple Python IDE thing Eko gave us a while back
should have linked that.
Cheers