簡體   English   中英

Py2exe無法將python腳本轉換為Windows可執行文件

[英]Py2exe cannot be convert python script to Windows executables

我想用py2exe將python腳本制作成Windows可執行文件。 我沒有錯過MSVCP90.dll和Feiwings.py(用於轉換的文件)和setup.py在同一路徑下。 在命令窗口下執行這些操作,一切正常,回溯的最后幾行是:

**binary dependencies****
your executable(s) also depend on these dlls which are not included. You may or may not need to distribute them.
Make sure you have the license if you distribute any of them, and make sure you don't distribute files belonging to the operating system.
USER32.dll -C:\WINDOWS\system32\USER32.dll
SHELL32.dll -C:\WINDOWS\system32\SHELL32.dll
ADVAPI32.dll -C:\WINDOWS\system32\ADVAPI32.dll
WS2_32.dll -C:\WINDOWS\system32\WS2_32.dll
GDI32.dll -C:\WINDOWS\system32\GDI32.dll
KERNEL32.dll -C:\WINDOWS\system32\KERNEL32.dll

setup.py的內容如下:

from distutils.core import setup
import py2exe

setup(console=['D:\python\Feiwings.py'])

當我對dist目錄的路徑進行cd時,出現錯誤。

Traceback (most recent call last):
  File "Feiwings.py", line 2, in <module>
  File "PySide\__init__.pyc", line 45, in <module>
  File "PySide\__init__.pyc", line 43, in _setupQtDirectories
UnboundLocalError: local variable 'path' referenced before assignment

提前致謝!

您的PySide發行版似乎出了點問題。 從追溯開始,它在Feiwings程序的第二行顯示了一個問題。 在這一行中,可能有一個import語句,您可以在其中從PySide導入某些內容,對嗎?

除了py2exe問題外,您還能正常執行代碼而不會引發相同錯誤嗎? 如果是這樣,我猜您應該在設置中包括其他軟件包依賴項(例如:PySide),類似於:

setup(packages=['PySide'],
      console=['D:\python\Feiwings.py'])

希望能幫助到你!

檢查程序中的變量“路徑”。 似乎不是Pyside的錯誤(假設您已正確安裝Pyside),而是使用變量'path'的方式。 看一下錯誤,似乎您在分配變量任何值之前都使用了變量“ path”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM