【发布时间】:2020-08-05 03:33:13
【问题描述】:
我尝试从 PyCharm 编译一个 python 文件,但在 warning.txt 文件中出现了不同的错误。
这是我在文件中使用的导入:
from selenium import common
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
这是“build/filename/filename.txt”中的错误
missing module named 'selenium.webdriver' - imported by C:\Users\Raphael\PycharmProjects\InstaBot\InstaBot_2_0.py (top-level)
missing module named selenium - imported by C:\Users\Raphael\PycharmProjects\InstaBot\InstaBot_2_0.py (top-level)
我该如何解决? 我将 chrome- 和 geckodriver.exe 放在 FILENAME.exe 所在的文件夹中。
我尝试了不同的方法:
- 隐藏导入硒
- 将硒添加为二进制
- 获取了 --onefile 标志,但仍然出现错误
我找到并尝试了这个帖子:
No module named when using PyInstaller
How to include chromedriver with pyinstaller?
PyInstaller, spec file, ImportError: No module named 'blah'
感谢您阅读本文,祝您有愉快的一天!
我用:
- PyCharm:2020.1
- Python 3.7,蟒蛇
- Chromedriver 81.0.4044.69
- PyInstaller:3.6
- 硒:3.141.0
【问题讨论】:
-
我在使用
conda安装的 PyQt 导入时遇到了类似的问题。但是当我用pip安装它时,我不再有这个问题了。考虑使用pip install selenium安装 selenium
标签: python selenium selenium-webdriver pyinstaller