Traceback (most recent call last):
File "test.py", line 1, in <module>
File "" , line 1007, in _find_and_load
File "" , line 986, in _find_and_load_unlocked
File "" , line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "text2vec\__init__.py", line 15, in <module>
File "" , line 1007, in _find_and_load
File "" , line 986, in _find_and_load_unlocked
File "" , line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "text2vec\cosent_model.py", line 17, in <module>
File "" , line 1007, in _find_and_load
File "" , line 986, in _find_and_load_unlocked
File "" , line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "text2vec\cosent_dataset.py", line 11, in <module>
File "" , line 1007, in _find_and_load
File "" , line 986, in _find_and_load_unlocked
File "" , line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "datasets\__init__.py", line 52, in <module>
File "" , line 1007, in _find_and_load
File "" , line 986, in _find_and_load_unlocked
File "" , line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "datasets\inspect.py", line 30, in <module>
File "" , line 1007, in _find_and_load
File "" , line 986, in _find_and_load_unlocked
File "" , line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "datasets\load.py", line 58, in <module>
File "" , line 1007, in _find_and_load
File "" , line 986, in _find_and_load_unlocked
File "" , line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "datasets\packaged_modules\__init__.py", line 31, in <module>
File "inspect.py", line 1024, in getsource
File "inspect.py", line 1006, in getsourcelines
File "inspect.py", line 835, in findsource
OSError: could not get source code
[16480] Failed to execute script 'test' due to unhandled exception!
从上可以得到关键信息:
File “text2vec_init_.py”, line 15, in < module >
…
File “datasets\inspect.py”, line 30, in < module >
…
原因为text2vec、datasets等第三方库没有导入,动态库打包运行时需要库的源文件,将D:\anaconda3\Lib\site-packages(自己的anaconda路径)下的text2vec、datasets文件夹复制到dist/(项目名称)/下即可。