我不知道为什么即使在 pip 安装之后也无法导入 selenium
。有谁知道我还能如何排除故障或解决此问题?
我使用的是 Mac 操作系统和 python 3.7.4
python3
Python 3.7.4
Type "help", "copyright", "credits" or "license" for more information.
>>> import selenium
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'selenium'
>>>
pip3 install selenium
Requirement already satisfied: selenium in /usr/local/lib/python3.7/site-packages
Requirement already satisfied: urllib3 in /usr/local/lib/python3.7/site-packages (from selenium)
更新
我有点乱七八糟,我所做的一件事帮助它成功了。我不确定哪些项目,但如果有人可以解释一下,以便我将来理解这一点,那将不胜感激。
- 我做了
brew doctor
,输出了以下内容
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or
https://developer.apple.com/download/more/.
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
python
brew 链接 --overwrite python
vi/usr/local/bin/pip
并将 /usr/local/opt/python/bin/python3.7
更改为 /usr/local/opt/python/bin/python3
并且它有效我猜我的问题是我安装了两个 python 实例,因此它将 selenium 库下载到不同的 python 版本 (3.7),而不是我想要的 3。
如果您认为这是问题所在,或者您是否可以澄清您认为问题所在,请告诉我
我是一名优秀的程序员,十分优秀!