2011-01-24 40 views
1

我已經安裝了python 2.6和新版本的py2exe。Python - py2exe - DeprecationWarning

hello.py

print "Hello from py2exe" 

setup.py

from distutils.core import setup 
import py2exe 

setup(
    # The first three parameters are not required, if at least a 
    # 'version' is given, then a versioninfo resource is built from 
    # them and added to the executables. 
    version = "0.5.0", 
    description = "py2exe sample script", 
    name = "py2exe samples", 

    # targets to build 
    windows = ["test_wx.py"], 
    console = ["hello.py"], 
    ) 

,我已經試過這在控制檯

python setup.py install 

但我收到此錯誤信息

D:\Python26\lib\site-packages\py2exe\build_exe.py:16: DeprecationWarning: the sets module is deprecated 
import sets 
running install 
running build 
running install_egg_info 
Removing D:\Python26\Lib\site-packages\py2exe_samples-0.5.0-py2.6.egg-info 
Writing D:\Python26\Lib\site-packages\py2exe_samples-0.5.0-py2.6.egg-info 

我錯了什麼?我該如何解決它?

+1

1.當你想建立一個EXE文件時,爲什麼要執行`python setup.py install`? 2.警告有什麼問題 - sets模塊*被棄用,因爲它被內建的`set`和`frozenset`類型取代。似乎py2exe仍然在某處使用它。 – AndiDog 2011-01-24 08:20:13

+0

是的,當然!你是對的,我正確的類型錯誤的命令,我必須使用`python setup.py py2exe` – Meloun 2011-01-24 08:25:16

回答

4

它不是一個錯誤,它只是一個關於被棄用類的警告;在這種情況下,sets模塊已被棄用,新代碼現在應該使用內置的set類。