如题
我在虚拟环境中安装的pyinstaller会一直往虚拟环境外面的site-package抓东西
大致上在 10445 INFO: Looking for dynamic libraries 之后
会列出一大堆路径
然后就可以看到pyinstaller开始往奇怪的路径上抓东西
另外,我用Auto-py-to-exe去抓额外档案时,发现虚拟环境中连matplotlib都找不到
打包完的档案用cmd去执行也是显示没有matplotlib
问gpt说是在程式里面用sys先砍光路径后新增路径
可是这样做又有别的问题......
之后试着用hidden import的方式把抓不到的matplotlib和nanoscope这两个抓进去
结果用cmd运行执行档的结果如下:
C:\Users\User\Desktop\myenv\dist>t
Traceback (most recent call last):
File "t.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "nanoscope\__init__.py", line 7, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "nanoscope\files\__init__.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "nanoscope\files\base.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "nanoscope\dll.py", line 81, in <module>
File "nanoscope\dll.py", line 38, in _load
File "os.py", line 1117, in add_dll_directory
FileNotFoundError: [WinError 3] 系统找不到指定的路径。:
'C:\\Users\\User\\AppData\\Local\\Temp\\_MEI149682\\nanoscope\\Lib\\64bit'
[24128] Failed to execute script 't' due to unhandled exception!
是有些site-package不该抱持能够用pyinstaller去包装的希望吗?