在Ubuntu里面,python2.7里使用selenium的webdriver时,在import selenium时有如下提示:
Python 2.7.12 (default, Aug 13 2018, 14:42:26)
[GCC 4.6.3] 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
确认使用sudo pip install selenium后,在/usr/local/lib/python2.7/dist-packages/目录下有selenium目录,只需要将该目录复制到/usr/local/lib/python2.7/site-packages/目录下即可,复制后再次导入会有urllib3同样的错误,同样的解决方法。
网友评论