2017-07-07 59 views
0
C:\WINDOWS\system32>py C:\Users\Lenovo\Desktop\RPGTxtGame\setup.py build 
running build 
running build_exe 
Traceback (most recent call last): 
    File "C:\Users\Lenovo\Desktop\RPGTxtGame\setup.py", line 5, in <module> 
    cx_Freeze.setup(name = "downloads", version = "1.0", options = {"build_exe": {"packages": ["errno", "os", "re", "stat", "subprocess","collections", "pprint","shutil", "humanize","pycallgraph"], "include_files": []}}, executables = exe) 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\dist.py", line 349, in setup 
    distutils.core.setup(**attrs) 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\distutils\core.py", line 148, in setup 
    dist.run_commands() 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 955, in run_commands 
    self.run_command(cmd) 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command 
    cmd_obj.run() 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\distutils\command\build.py", line 135, in run 
    self.run_command(cmd_name) 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\distutils\cmd.py", line 313, in run_command 
    self.distribution.run_command(command) 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command 
    cmd_obj.run() 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\dist.py", line 219, in run 
    freezer.Freeze() 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\freezer.py", line 621, in Freeze 
    self.finder = self._GetModuleFinder() 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\freezer.py", line 340, in _GetModuleFinder 
    finder.IncludePackage(name) 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 653, in IncludePackage 
    module = self._ImportModule(name, deferredImports) 
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 350, in _ImportModule 
    raise ImportError("No module named %r" % name) 
ImportError: No module named 'humanize' 

嗨,我試圖從我的python項目創建一個可執行文件。 cx_Freeze是givinig這個錯誤,雖然Python cx_Freeze導入錯誤「沒有模塊命名人性化」

我也試過pyinstaller但一個不與Python兼容3.6

我setup.py腳本是

import cx_Freeze 

exe = [cx_Freeze.Executable("main.py")] 

cx_Freeze.setup(name = "downloads", version = "1.0", options = {"build_exe": {"packages": ["errno", "os", "re", "stat", "subprocess","collections", "pprint","shutil", "humanize","pycallgraph"], "include_files": []}}, executables = exe) 

你能幫助我嗎?

+0

你有一個名爲模塊人文化? –

+0

不,我沒有導入它,但我也沒有導入setup.exe –

+0

中說明的其他包我猜你可能必須首先安裝人性化。你可能已經有其他的軟件包了。 –

回答

0

這是我該怎麼做的。

from cx_Freeze import setup, Executable 

build_exe_options = {"packages": ["errno", "os", "re", "stat", "subprocess","collections", "pprint","shutil", "humanize","pycallgraph"]} 

setup(name = "downloads", 
     version = "1.0", 
     options = {"build_exe": build_exe_options}, 
     description = "Your description here.", 
     executables = [Executable("main.py")]) 

由於根據您的環境一個側面說明你不應該需要明確地包括像「OS」,「重」,「shutil」或其他任何標準庫模塊作爲cx_Freeze應該能夠找到和自動導入。

還要確保你的「人性化」包是在你的「main.py」腳本中導入的。

+0

好吧,所以我安裝了它所要求的所有軟件包,人性化之後我最終也安裝了pycallgraph。現在它說沒有這樣的文件/目錄'main.py'。雖然setup.py和main.py在同一個文件夾中 –

0

好的,我完全避免了setup.py。

有一個在Official documentation

打字另一種方式..

cxfreeze main.py 

在cmd爲我的作品

相關問題