Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
appwiki:notepadplusplus [2023/02/02 09:02] – [Qt GUI and PythonScript] ying | appwiki:notepadplusplus [2023/02/06 06:40] (current) – [Plugin - PythonScript] ying | ||
---|---|---|---|
Line 90: | Line 90: | ||
* install: | * install: | ||
- | * from plugin manager | + | |
- | * or download manually and put in plugin folder from http:// | + | |
+ | * for tkinter lib, go lastest release version: https:// | ||
+ | * unzip PythonScript_TclTk_xxx.xxx.zip, | ||
+ | * (optional) unzip PythonScript_ExtraLibs_xxxx.zip if you need lib2to3, distutils, | ||
+ | * (outdate) <del>or download manually and put in plugin folder from http:// | ||
+ | </ | ||
* Python for Npp document | * Python for Npp document | ||
* http:// | * http:// | ||
Line 250: | Line 254: | ||
* the default loading directory for NppPythonScript plugin, any script will be automatically add to path for import < | * the default loading directory for NppPythonScript plugin, any script will be automatically add to path for import < | ||
npp\plugins\PythonScript\lib | npp\plugins\PythonScript\lib | ||
- | npp\plugins\PythonScript\scripts | + | npp\plugins\PythonScript\scripts |
npp\plugins\Config\PythonScript\lib | npp\plugins\Config\PythonScript\lib | ||
npp\plugins\Config\PythonScript\scripts | npp\plugins\Config\PythonScript\scripts | ||
Line 340: | Line 344: | ||
* once ok, you can use your own python to install package, and add the site-packages path to PythonScript python' | * once ok, you can use your own python to install package, and add the site-packages path to PythonScript python' | ||
* start your standalone python, and run (PySide, | * start your standalone python, and run (PySide, | ||
+ | import subprocess | ||
+ | import sys | ||
+ | def install(package): | ||
+ | subprocess.check_call([sys.executable, | ||
# py2 case: 2.7 = PySide | # py2 case: 2.7 = PySide | ||
- | import pip | + | install(" |
- | pip._internal.main([' | + | |
# py3 case: 3.x = PySide2 | # py3 case: 3.x = PySide2 | ||
- | import pip | + | install(" |
- | pip.main([" | + | |
</ | </ | ||
+ | * add that standalone package path to PythonScript config startup.py file < | ||
+ | # notepad path\plugins\Config\PythonScript\scripts\startup.py | ||
+ | </ | ||
+ | # optional clear multiple python registered system path issue | ||
+ | old_path = sys.path | ||
+ | old_path = [x for x in old_path if not x.startswith(' | ||
+ | sys.path = old_path | ||
+ | # register lib path | ||
+ | import os | ||
+ | my_path_list =[ | ||
+ | r' | ||
+ | r' | ||
+ | r' | ||
+ | ] | ||
+ | for x in my_path_list: | ||
+ | if os.path.isdir(x): | ||
+ | sys.path.append(x) | ||
+ | |||
+ | </ | ||
==== My Npp Python Script ==== | ==== My Npp Python Script ==== | ||