简体   繁体   中英

python with bpy to exe

I've written a python script witch includes the bpy bibliothec. The python script runs perfectly. But if I convert the script with auto-py-to-exe it dosen't start. If I convert it as console based.exe, the console give me the following error:

bpy: couldn't find 'scripts/modules', blender probably won't start.
Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.
ModuleNotFoundError: No module named 'bpy_types'
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:7337 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:7337 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:7337 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:7337 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:7337 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:7337 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:7337 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:7337 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:7337 pyrna_srna_ExternalType: failed to find 'bpy_types' module

I've installed it with auto-py-to-exe as "one directory" and "single file". But it makes no difference.

I have no Idea wehere to find the folder. Something strange is also that if I understand correctly "blender-v340" the v440 is the version, but on my PC I have blender 3.5. Could it be that the bpy package could not be executed from the exe file?

Edit: I've made some changes at the auto-py-to-exe config:

Additional Files: added the missing file: bpy_types.py Advanced: --paths: give the path to the bpy modul directory (C:/Users/myUsername/AppData/Local/Programs/Python/Python310/3.5/scripts/modules) --hidden-import: bpy

Now the exe file starts with the following Error message:

Traceback (most recent call last):
  File "grafisch_obl_fbx.py", line 7, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "bpy\__init__.py", line 20, in <module>
ModuleNotFoundError: No module named '_bpy'

But I can't find the _bpy file

I found a solution: At auto-py-to-exe, i made some changes:

Advanced: --collect-submodules: bpy --collect-all: bpy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM