简体   繁体   中英

cx_freeze programs won't run. Error given about no jsonpickle module. Python 3.4

I have recently tried to make a .exe program with cx_freeze and it usually works. But I have started using jsonpickle as a module and now my programs do not work anymore. They run in the idle but when I turn them into a .exe, they refuse to run. I don't know what the issue would be. It also tells me that jsonpickle is not a module even though I do in fact use that module. If you need my setup.py file, here it is:

import cx_Freeze, sys
from cx_Freeze import setup, Executable

exe=Executable(
     script="gtn.py",
     base="Console",
     icon = "gtn.ico",
     )
includefiles=[]
includes=["re"]
excludes=[]
packages=[]
setup(

     version = "14w03a",
     description = "oysterDev©",
     author = "Austin Hargis",
     name = "GTN",
     options = {'build_exe': {'excludes':excludes,'packages':["jsonpickle"],'include_files':includefiles}},
     executables = [exe]
     )

This is the error I receive when I try to run the .exe:

C:\Users\Austin\Desktop\build\exe.win32-3.4>gtn.exe
Traceback (most recent call last):
  File "c:\python34\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
    exec(code, m.__dict__)
  File "gtn.py", line 3, in <module>
  File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2214, in _find_a
nd_load
  File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2201, in _find_a
nd_load_unlocked
ImportError: No module named 'jsonpickle'

I don't use cx_Freeze but from what I see line 19 looks into includefiles list for packages you want to include and list on line 9 includefiles=[] is eampty.

Try to change the line 9 to includefiles=["jsonpickle"]

Edit: if that doesn't work try to change

includes = []

to

includes = ["re","jsonpickle"]

That worked for me

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