PythonScript icon indicating copy to clipboard operation
PythonScript copied to clipboard

how to install 3rd lib

Open Jzhenli opened this issue 4 years ago • 6 comments
trafficstars

Hi, just want to know how to install 3rd python lib for this plugin?

Jzhenli avatar Apr 28 '21 03:04 Jzhenli

@Jzhenli What do you mean with 3rd python lib? Python version 3, e.g. https://www.python.org/downloads/release/python-394/?

chcg avatar May 01 '21 17:05 chcg

@chcg if I want to install pandas or numpy lib for the PythonScript, how to do it?

Jzhenli avatar May 04 '21 03:05 Jzhenli

@Jzhenli You don't. If you want to use such libraries, you must have a local Python installation and copy the pythonX.dll into the pythonscript plugin directory to replace the one that comes with the plugin itself.

Ekopalypse avatar May 06 '21 20:05 Ekopalypse

In config dialog you have to check that your local installation is preferred, see grafik

The python environment coming with this plugin doesn't contain pip, so installation of additional python packages is not possible this way. Be aware that you still need a python 2.7 installation with the official releases (latest v1.5.4) of the python plugin. There are prereleases for python 3 (latest https://github.com/bruderstein/PythonScript/releases/tag/v3.0.8), but they still have limitations.

chcg avatar May 06 '21 22:05 chcg

@Ekopalypse @chcg How does PythonScript determine where my locally installed Python packages are located?

I have two versions of Python installed (3.9 and 3.10). PythonScript is running Python 3.10, but then trying to load packages from my 3.9 installation (and failing). I've set my PATH to point to 3.10, but PythonScript still insists on loading the 3.9 packages.

If I do sys.path.insert(1, 'path/to/python310/lib/site-packages'), then it seems to import correctly. Is that the best way to do it? I don't know if site.py is somehow involved in situations like this.

harry-commin-enclustra avatar Apr 19 '22 14:04 harry-commin-enclustra

This is done internally by python itself. Yes, if you are using multiple versions, this may be the only way to ensure that the correct path is used. Remember that PythonScript behaves like a Python REPL, it stores this information as long as Npp is running.

Ekopalypse avatar Apr 21 '22 09:04 Ekopalypse