关于python:“ImportError:没有名为selenium的模块”

“ImportError: No module named selenium”

1
2
3
4
Installed selenium using pip : pip install selenium
pip version : pip 8.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7)

python version : Python 2.7.5

之前没有收到这个错误。

1
"ImportError: No module named selenium"

不久前升级了pip并开始获取此错误。从前面的问题中找不到任何有用的内容。

SysPATH:"",/system/library/frameworks/python.framework/versions/2.7/lib/python27.zip","/system/library/frameworks/python.framework/versions/2.7/lib/python2.7","/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat darwin","/system/library/frameworks/python.framework/versions/2.7/lib/plat mac","/system/library/framerks/python.framework/versions/2.7/lib/python2.7/plat mac/lib scriptpackages","/system/library/frameworks/python.framework/versions/2.7/extras/lib/python","/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/lib old","/system/library/frameworks/python.framework/versions/2.7/lib old","/system/library/frameworksthon.framework/versions/2.7/lib/python2.7/lib dynload","/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/pyobjc","/library/python/2.7/site packages']

有人能帮忙吗?


请检查您的机器中是否有多个python解释器。

在终端中检查python默认的解释器是什么,然后按Enter键。

如果它与安装时提到的Y PIP版本相同,则不应该有任何问题。

否则,

通过在bash文件中保留别名来更改默认解释器,

根据您的解释器版本,将下面的行附加为最后一行

1
alias python='/usr/bin/python2.7.6'