appwiki:notepadplusplus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
appwiki:notepadplusplus [2023/02/02 08:46] – [My Npp Python Script] yingappwiki:notepadplusplus [2023/02/06 06:40] (current) – [Plugin - PythonScript] ying
Line 90: Line 90:
  
   * install:   * install:
-    * from plugin manager +    * install/get latest notepad++ 
-    * or download manually and put in plugin folder from http://npppythonscript.sourceforge.net/ +    * from plugin manager, search python script, check and install (default is v2, w python 2.7.18, you can use same method to manually use alpha py3.10.9 version with same method) 
 +    * for tkinter lib, go lastest release version: https://github.com/bruderstein/PythonScript/releases/ 
 +      * unzip PythonScript_TclTk_xxx.xxx.zip, and copy lib into npp/plugins/PythonScripts lib folder. 
 +      * (optional) unzip  PythonScript_ExtraLibs_xxxx.zip if you need lib2to3, distutils,bsddb 
 +    * (outdate) <del>or download manually and put in plugin folder from http://npppythonscript.sourceforge.net/ 
 +</del>
   * Python for Npp document   * Python for Npp document
     * http://npppythonscript.sourceforge.net/docs/latest/     * http://npppythonscript.sourceforge.net/docs/latest/
Line 250: Line 254:
   * the default loading directory for NppPythonScript plugin, any script will be automatically add to path for import <code>   * the default loading directory for NppPythonScript plugin, any script will be automatically add to path for import <code>
 npp\plugins\PythonScript\lib npp\plugins\PythonScript\lib
-npp\plugins\PythonScript\scripts +npp\plugins\PythonScript\scripts (default startup.py is here)
 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's sys.path     * once ok, you can use your own python to install package, and add the site-packages path to PythonScript python's sys.path
     * start your standalone python, and run (PySide,PyQt4,PySide2,PyQt5 depends on your PythonScript plugin's python version) <code python>     * start your standalone python, and run (PySide,PyQt4,PySide2,PyQt5 depends on your PythonScript plugin's python version) <code python>
-my case2.7 = PySide3.x = PySide2 +import subprocess 
-import pip +import sys 
-pip.main(["install","PySide"])+def install(package): 
 +    subprocess.check_call([sys.executable, "-m", "pip", "install", package]) 
 +py2 case2.7 = PySide 
 +install("PySide"
 + 
 +# py3 case: 3.x = PySide2 
 +install("PySide2")
 </code> </code>
 +  * add that standalone package path to PythonScript config startup.py file <code>
 +# notepad path\plugins\Config\PythonScript\scripts\startup.py
 +</code> and code <code python>
 +# optional clear multiple python registered system path issue
 +old_path = sys.path
 +old_path = [x for x in old_path if not x.startswith('D:\\my_other_system_env_registered_python_path\\Python27') ]
 +sys.path = old_path
  
 +# register lib path
 +import os
 +my_path_list =[
 +    r'D:\my_path_match_version_local_python_path\Python27\Lib\site-packages',
 +    r'D:\my_path_to_other_mpp_app_i_write\NppCoder',
 +    r'D:\my_path_to_other_npp_script\npp_script'
 +    ]
 +for x in my_path_list:
 +    if os.path.isdir(x):
 +        sys.path.append(x)
 +
 +</code>
 ==== My Npp Python Script ==== ==== My Npp Python Script ====
  
  • appwiki/notepadplusplus.1675327563.txt.gz
  • Last modified: 2023/02/02 08:46
  • by ying