【PY】PyQT 依賴

kingdelee發表於2019-07-07

pip install PyQt5
pip3 install PyQt5-sip
pip3 install pyqtdeploy
pip3 install QScintilla
pip3 install PyQtWebEngine
pip3 install PyQtDataVisualization
pip3 install PyQtChart
pip3 install PyQt3D
pip3 install pyinstaller
pip3 install PyQtPurchasing

打包:

建立虛擬環境 啟用虛擬環境:

cd c:/pyenv
python3 -m venv pyqt5venv
cd pyqt5venv/Scprits
source activate

安裝依賴:

pip install PyQt5
pip install pyinstaller

坑爹問題解決:

參考:
1.

不適用虛擬環境的時候出現的問題解決:
1.用360安裝,微軟常用執行庫合集64位,可以解決 dll錯誤的情況
2..新增path也可以解決dll找不到的情況
建立PyQT5_HOME:
C:\Python\Python37\Lib\site-packages\PyQt5\Qt
加入到Path中
${PyQT5_HOME}/bin

使用虛擬環境時出現的問題解決:
1.pyinstaller本身問題:
下載bindepend.py 並替換
C:\pyenv\pyqt5venv\Lib\site-packages\PyInstaller\depend 中對應檔案
下載地址:
https://github.com/Loran425/pyinstaller/tr...

Traceback (most recent call last):                                                                            
  File "C:\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main                                    
    "__main__", mod_spec)                                                                                     
  File "C:\Python\Python37\lib\runpy.py", line 85, in _run_code                                               
    exec(code, run_globals)                                                                                   
  File "C:\pyenv\pyqt5venv\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>                          
  File "c:\pyenv\pyqt5venv\lib\site-packages\PyInstaller\__main__.py", line 111, in run                       
    run_build(pyi_config, spec_file, **vars(args))                                                            
  File "c:\pyenv\pyqt5venv\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build                  
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)                                     
  File "c:\pyenv\pyqt5venv\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main           
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))                            
  File "c:\pyenv\pyqt5venv\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build          
    exec(text, spec_namespace)                                                                                
  File "<string>", line 32, in <module>                                                                       
  File "c:\pyenv\pyqt5venv\lib\site-packages\PyInstaller\building\api.py", line 424, in __init__              
    strip_binaries=self.strip, upx_binaries=self.upx,                                                         
  File "c:\pyenv\pyqt5venv\lib\site-packages\PyInstaller\building\api.py", line 196, in __init__              
    self.__postinit__()                                                                                       
  File "c:\pyenv\pyqt5venv\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__   
    self.assemble()                                                                                           
  File "c:\pyenv\pyqt5venv\lib\site-packages\PyInstaller\building\api.py", line 273, in assemble              
    pylib_name = os.path.basename(bindepend.get_python_library_path())                                        
  File "C:\Python\Python37\lib\ntpath.py", line 214, in basename                                              
    return split(p)[1]                                                                                        
  File "C:\Python\Python37\lib\ntpath.py", line 183, in split                                                 
    p = os.fspath(p)                                                                                          
TypeError: expected str, bytes or os.PathLike object, not NoneType              

使用upx:
下載:
https://github.com/upx/upx
解壓到
c:\Tools\upx
打包的時候使用upx:
pyinstaller
https://github.com/upx/upx

UPX報錯:
【PY】PyQT 依賴
解決:
https://jingyan.baidu.com/article/a681b0de...
https://www.fixdown.com/soft/1921.html
https://zhidao.baidu.com/question/50137916...

打包詳細說明:
https://blog.csdn.net/polyhedronx/article/...
https://blog.csdn.net/oh5W6HinUg43JvRhhB/a...

相關文章