简体   繁体   English

cx_freeze程序将无法运行。 给出有关没有jsonpickle模块的错误。 Python 3.4

[英]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. 我最近尝试用cx_freeze制作一个.exe程序,它通常可以工作。 But I have started using jsonpickle as a module and now my programs do not work anymore. 但是我已经开始使用jsonpickle作为模块,现在我的程序不再起作用。 They run in the idle but when I turn them into a .exe, they refuse to run. 它们在空闲状态下运行,但是当我将其转换为.exe时,它们拒绝运行。 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. 它也告诉我,即使我确实使用jsonpickle也不是一个模块。 If you need my setup.py file, here it is: 如果您需要我的setup.py文件,则为:

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: 这是我尝试运行.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. 我不使用cx_Freeze,但是从我看到的第19行来看,您想要包含的软件包的includefiles列表中出现,而在第9行中,includefiles = []列表却很含糊。

Try to change the line 9 to includefiles=["jsonpickle"] 尝试将第9行更改为includefiles = [“ jsonpickle”]

Edit: if that doesn't work try to change 编辑:如果不起作用,请尝试更改

includes = []

to

includes = ["re","jsonpickle"]

That worked for me 那对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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