安装了Selenium-3.0和Python 2.7但没有模块错误

Selenium-3.0 and Python 2.7 Installed But No Module Error

我在StackOverflow找到的东西都试过了。我没有选择了。怎么了?

1
2
3
4
5
6
7
8
9
10
11
12
13
Praysons-MacBook-Pro:pyChrome praysondaniel$ pip install -U selenium
Requirement already up-to-date: selenium in /usr/local/lib/python2.7/site-packages/selenium-3.0.0b3-py2.7.egg

Praysons-MacBook-Pro:pyChrome praysondaniel$ python
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type"help","copyright","credits" or"license" for more information.

>>> from selenium import webdriver
Traceback (most recent call last):
  File"<stdin>", line 1, in <module>
ImportError: No module named selenium
>>>

我尝试过这里的所有其他建议,包括这个重要错误:没有名为"Selenium"的模块。

1
2
3
>>> import sys; sys.path
['', '/Library/Frameworks/SQLite3.framework/Versions/C/Python/2.7', '/Library/Frameworks/GEOS.framework/Versions/3/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/numpy-override', '/Library/Python/2.7/site-packages/matplotlib-override', '/Library/Frameworks/GDAL.framework/Versions/1.11/Python/2.7/site-packages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
>>>


唯一的解决方案是创建一个虚拟环境。在我的虚拟环境中,我会安装-u Selenium和Walla!它工作