Selenium安装在python中,但仍然无法导入模块?

时间:2015-05-19 18:20:06

标签: python selenium pip

我正在使用linux mint。我用pip安装了selenium,它没有问题。然后我运行python并尝试检查selenium的工作原理:

ethomas@ethomas-linux ~ $ python
Python 2.7.9 (default, May 19 2015, 13:47:37) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import selenium
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named selenium

然后在python中我做了:

>>> import sys
>>> sys.executable
'/usr/local/bin/python'
>>> sys.path
['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']

我运行了$ locate selenium,它都在/usr/local/lib/python2.7/dist-packages/selenium中找到。然而,我仍然无法在python中导入selenium。谁知道问题可能是什么?它可能与sys.path有关,但我不确定。

1 个答案:

答案 0 :(得分:0)

我已经安装了python 2.7.9,而我的盒子上的默认值是2.7.6,因此它将它放入usr / local / bin并导致错误。从usr / local / bin删除它修复了probelm。