我已經使用py2exe創建了一個exe文件,但它給我一個屬性錯誤和執行導入錯誤。我已經使用的urllib2和BeautifulSoup我的主腳本,這是abc.py我應該如何解決使用py2exe生成的屬性和導入錯誤?
這裏是我的setup.py:
from distutils.core import setup
import py2exe
setup(console=['abc.py'])
options={"py2exe": {'includes': ["BeautifulSoup"]}}
我已經提到了另一個問題本網站後添加了「包括」參數。但它不適合我。
我從abc.exe得到的輸出是
C:\Users\Dhruv Mullick\Desktop\dist>abc.exe Traceback (most recent call last): File "C:\Python27\lib\site-packages\py2exe\boot_common.py", line 92, in import linecache File "linecache.pyc", line 9, in File "os.pyc", line 398, in File "UserDict.pyc", line 83, in File "_abcoll.pyc", line 11, in File "abc.pyc", line 3, in File "bs4__init__.pyc", line 30, in File "bs4\builder__init__.pyc", line 1, in File "collections.pyc", line 6, in AttributeError: 'module' object has no attribute 'all' Traceback (most recent call last): File "abc.py", line 3, in File "bs4__init__.pyc", line 26, in File "os.pyc", line 398, in File "UserDict.pyc", line 83, in File "_abcoll.pyc", line 11, in File "abc.pyc", line 3, in ImportError: cannot import name BeautifulSoup
C:\Users\Dhruv Mullick\Desktop\dist>