当我安装Selenium时,出现以下错误:
Shubham@Shubham-To-be-filled-by-O-E-M:~$ sudo apt-get update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:2 https://repo.skype.com/deb stable InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Fetched 323 kB in 8s (38.6 kB/s)
Reading package lists... Done
Shubham@Shubham-To-be-filled-by-O-E-M:~$ sudo pip install selenium
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
我应该如何进行?
可从Ubuntu 16.04及更高版本中的默认Ubuntu存储库中获取Selenium。要安装硒,请打开终端并输入:
sudo apt install python-selenium # for Python 2.x
和/或
sudo apt install python3-selenium # for Python 3.x
然后键入python
以启动Python解释器,并且from selenium import webdriver
应该像这样工作:
$ python >>>来自selenium import webdriver
假设该路径~/.local/bin
位于您的执行PATH中,那么以下是安装名为geckodriver的Firefox Webdriver的方法:
wget https://github.com/mozilla/geckodriver/releases/download/v0.20.1/geckodriver-v0.20.1-linux64.tar.gz
tar xvfz geckodriver-v0.20.1-linux64.tar.gz
mv geckodriver ~/.local/bin
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句