2017-07-07 72 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は私もpyinstallerを試してみましたが、その一つが私のsetup.pyスクリプトがPython cx_Freezeインポートエラー "No module named humanize"

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) 

あなたは私を助けてもらえある3.6

のpythonと互換性がありません?

かかわらず、このエラーをgivinigされますか

+0

の作品がありますか? –

+0

いいえ、私はそれをインポートできませんでしたが、setup.exeに記載されている他のパッケージもインポートしませんでした。 –

+0

まずhumanizeをインストールする必要があるかもしれません。すでに他のパッケージが既にあるでしょう。 –

答えて

0

ここで私はそれをやります。あなたが明示的に「OS」、「再」、「shutil」またはcx_Freezeなど他の標準ライブラリモジュールを見つけることができるはずとのようなものを含める必要はありません、ご使用の環境に応じて、サイドノートとして

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")]) 

それらを自動的にインポートします。

また、 "humanize"パッケージが "main.py"スクリプトにインポートされていることを確認してください。

+0

それで、私が要求したパッケージをすべてインストールしました。ヒューマナイズした後、私はpycallgraphもインストールしました。今は、そのようなファイル/ディレクトリ 'main.py'はないと言います。 setup.pyとmain.pyは同じフォルダにありますが –

0

私はsetup.pyを完全に避けることで修正しました。

あなたが人間化という名前のモジュールを持っていますかCMDでOfficial documentation

型付け..

cxfreeze main.py 

内の別の方法は私

関連する問題