“ImportError: No module named selenium”

2019-08-03 07:56发布

Installed selenium using pip : pip install selenium<br>
pip version : pip 8.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7)<br>

python version : Python 2.7.5

Wasn't getting this error earlier.

"ImportError: No module named selenium"

Upgraded pip a while ago and started getting this error. Couldn't find anything useful from earlier questions.

sys.path:
['', '/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/python2.7/plat-mac', '/System/Library/Frameworks/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-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.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']

Can anyone please help?

1条回答
趁早两清
2楼-- · 2019-08-03 08:30

Please check if you have multiple python interpreters in your machine.

check what is your default interpreter by python in your terminal and press ENTER.

if it is same as the version mentioned y PIP while installing, you should not have any problems.

or else,

change your default interpreter by keeping alias in your bash file,

append below line as last line as per your interpreter version

alias python='/usr/bin/python2.7.6'
查看更多
登录 后发表回答