我想讓我的Selenium應用程序工作。它編譯一切,但是當我打開應用程序它給了我這樣的:編譯好的py2exe應用程序硒文件丟失
C:\Python34\dist>browse.exe
Traceback (most recent call last):
File "browse.py", line 9, in <module>
File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 43, in __init__
self.profile = FirefoxProfile()
File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\firefox_profile
.py", line 64, in __init__
WEBDRIVER_PREFERENCES)) as default_prefs:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Python34\\dist\\lib
rary.zip\\selenium\\webdriver\\firefox\\webdriver_prefs.json'
我使用py2exe捆綁,和Firefox作爲瀏覽器的驅動程序。
Setup.py:
from distutils.core import setup
import py2exe
setup(
console=['browse.py'],
options={
"py2exe":{
"skip_archive": True,
"unbuffered": True,
"optimize": 2
}
}
)
你找到你的答案因爲我也有同樣的錯誤。並且你在下面選擇的答案也沒有幫助 – 2015-05-29 14:20:53