51Testing软件测试论坛
标题: selenium打包成exe报错errno2 [打印本页]
作者: 测试积点老人 时间: 2022-1-11 10:21
标题: selenium打包成exe报错errno2
问题遇到的现象和发生背景用pycharm写了一个简单的爬虫程序,使用的是selenium的代码。用pyinstaller打包成exe后报错,errno2
- # coding=utf-8
- from 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: [Errno 2] No such file or directory: 'C:\\Users\\T480\\AppData\\Local\\Temp\\_MEI318082\\selenium\\webdriver\\remote\\getAttribute.js'
复制代码 我的解答思路和尝试过的方法试过改文件运行路径,但是不行。
我想要达到的结果成功运行exe文件
作者: qqq911 时间: 2022-1-12 10:31
检查下环境变量
作者: jingzizx 时间: 2022-1-12 17:39
缺东西?
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) |
Powered by Discuz! X3.2 |