收藏
回答

小程序minium自动化pyinstaller打包成exe后, 运行提示找不到minitest?

一、在pycharm中运行主程序后,可以正确找到minium.MiniTest,如下:
print(minium)通过这个打印显示结果如下:
<module 'minium' from 'F:\\python\\minium\\venv\\lib\\site-packages\\minium\\__init__.py'>
二、但是通过pyinstaller打包后,运行打包后的exe,提示错误如下:partially initialized module 'minium' has no attribute 'MiniTest' (most likely due to a circular import)
从exe的打印的结果看,找到的路径是在工程跟目录下的minium文件夹
<module 'minium' from 'F:\\python\\minium\\dist\\autotest\\_internal\\minium\\__init__.pyc'>
Traceback (most recent call last):
  File "index.py", line 22, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "views\workplace_template_view.py", line 5, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "logic\engine\executetetesttemplate.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "testcase\test\testtemplate.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "__init__.py", line 3, in <module>
AttributeError: partially initialized module 'minium' has no attribute 'MiniTest' (most likely due to a circular import)
[PYI-36456:ERROR] Failed to execute script 'index' due to unhandled exception!
请各位大神分析下可能是什么原因,pyinstaller使用的是6.10版本


回答关注问题邀请回答
收藏

1 个回答

  • 老九
    老九
    星期一 10:03

    微信的库调用了js文件使用pyinstaller 打包时 只会将库中的 py文件进行打包并不会打包其他文件所以打包后会缺失必要js文件 所以 minium 无法正常打开


    星期一 10:03
    有用
    回复
登录 后发表内容