2025年1月15日星期三

python 环境变量

what-exactly-should-be-set-in-pythonpath
  •  PYTHONHOME

Change the location of the standard Python libraries. By default, the libraries are searched in prefix/lib/pythonversion and exec_prefix/lib/pythonversion, where prefix and exec_prefix are installation-dependent directories, both defaulting to /usr/local.


When PYTHONHOME is set to a single directory, its value replaces both prefix and exec_prefix. To specify different values for these, set PYTHONHOME to prefix:exec_prefix.


  • PYTHONPATH

Augment the default search path for module files. The format is the same as the shell’s PATH: one or more directory pathnames separated by os.pathsep (e.g. colons on Unix or semicolons on Windows). Non-existent directories are silently ignored.


In addition to normal directories, individual PYTHONPATH entries may refer to zipfiles containing pure Python modules (in either source or compiled form). Extension modules cannot be imported from zipfiles.


The default search path is installation dependent, but generally begins with prefix/lib/pythonversion (see PYTHONHOME above). It is always appended to PYTHONPATH.


An additional directory will be inserted in the search path in front of PYTHONPATH as described above under Interface options. The search path can be manipulated from within a Python program as the variable sys.path.

pyqgis

1 开发环境配置


@echo off
SET OSGEO4W_ROOT=C:\OSGeo4W
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
call "%OSGEO4W_ROOT%"\apps\grass\grass83\etc\env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
path %PATH%;%OSGEO4W_ROOT%\apps\grass\grass83\lib
path %PATH%;C:\OSGeo4W\apps\Qt5\bin
path %PATH%;C:\OSGeo4W\apps\Python312\Scripts

set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python
set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python312

set PATH=C:\Program Files\Git\bin;C:\Users\27096\AppData\Local\Programs\Microsoft VS Code;%PATH%

cmd.exe


C:\qgis_dev>python3 -c "import sys;print(sys.path)"
['', 
'C:\\aka\\my_git\\qgis_dev', 
'C:\\OSGeo4W\\bin',
'C:\\OSGeo4W\\bin\\python312.zip', 
'C:\\OSGeo4W\\apps\\grass\\grass83\\etc\\python', 
'C:\\OSGeo4W\\apps\\qgis\\python', 
'C:\\OSGeo4W\\apps\\Python312\\DLLs', 
'C:\\OSGeo4W\\apps\\Python312\\Lib', 
'C:\\OSGeo4W\\apps\\Python312', 
'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\win32', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\win32\\lib', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\Pythonwin'
]
上面的列表为了美观,顺序调整过,下面是原始输出:
[
'', 
'C:\\OSGeo4W\\apps\\grass\\grass83\\etc\\python', 
'C:\\aka\\my_git\\qgis_dev', 
'C:\\OSGeo4W\\apps\\qgis\\python', 
'C:\\OSGeo4W\\bin\\python312.zip', 
'C:\\OSGeo4W\\apps\\Python312\\DLLs', 
'C:\\OSGeo4W\\apps\\Python312\\Lib', 
'C:\\OSGeo4W\\bin', 
'C:\\OSGeo4W\\apps\\Python312',
 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\win32', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\win32\\lib', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\Pythonwin']

为什么存在  "C:\OSGeo4W\bin\python.exe"
这个文件有什么用?

  • OSGeo4W Shell ----->   C:\OSGeo4W\OSGeo4W.bat  
  • GRASS GIS 8.3.2------>  C:\OSGeo4W\bin\grass83.bat --gui
  • QGIS Desktop 3.36.3 ------>  C:\OSGeo4W\bin\qgis-bin.exe
  • Qt Designer with QGIS 3.36.3 custom widgets  ----> C:\OSGeo4W\bin\bgspawn.exe "C:\OSGeo4W\bin\qgis-designer.bat"
  • Setup  ---->  C:\OSGeo4W\bin\bgspawn.exe "C:\OSGeo4W\bin\setup.bat"
  • SAGA GIS 9.3.1  ---->  C:\OSGeo4W\bin\bgspawn.exe "C:\OSGeo4W\bin\saga_gui.bat"
uses bgspawn to the batch jobs, which has the advantage that there is no command line window flashing up when a desktop application starts.

2025年1月14日星期二

pyqt

 1、pyqt6

2、pyside6

2025年1月12日星期日

scp

youtube

  1.  https://github.com/yt-dlp/yt-dlp
  2. yt-dlp:  how-do-i-pass-cookies-to-yt-dlp
  3. https://github.com/yt-dlp/yt-dlp/issues/7271
  4. https://github.com/ytdl-org/youtube-dl/issues/33006
  5. https://github.com/yt-dlp/yt-dlp/issues/10927
  6. https://github.com/yt-dlp/yt-dlp#network-options
  7. Get cookies.txt LOCALLY
  8. C:\Users\username\AppData\Local\Google\Chrome\User Data\Default\Network
  9. yt-dlp.exe  --proxy socks5://127.0.0.1:10808/  --cookies   www.youtube.com_cookies.txt   https://youtu.be/xxxxxxxxxxxxx