selenium打包成exe报错errno2
问题遇到的现象和发生背景用pycharm写了一个简单的爬虫程序,使用的是selenium的代码。用pyinstaller打包成exe后报错,errno2# coding=utf-8from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get('http://www.baidu.com')
time.sleep(3)
运行结果及报错内容Traceback (most recent call last):
File "se_pachong.py", line 2, in <module>
from selenium import webdriver
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
File "selenium\webdriver\__init__.py", line 18, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
File "selenium\webdriver\firefox\webdriver.py", line 25, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
File "selenium\webdriver\remote\webdriver.py", line 42, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
File "selenium\webdriver\remote\switch_to.py", line 25, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
File "selenium\webdriver\remote\webelement.py", line 37, in <module>
File "pkgutil.py", line 639, in get_data
File "PyInstaller\loader\pyimod03_importers.py", line 325, in get_data
FileNotFoundError: No such file or directory: 'C:\\Users\\T480\\AppData\\Local\\Temp\\_MEI318082\\selenium\\webdriver\\remote\\getAttribute.js'
我的解答思路和尝试过的方法试过改文件运行路径,但是不行。我想要达到的结果成功运行exe文件
检查下环境变量 缺东西?
页:
[1]