如何使用python3安装selenium?

如何使用python3安装selenium?,python,selenium,ubuntu,setuptools,python-3.6,Python,Selenium,Ubuntu,Setuptools,Python 3.6,提取.tar.gz并运行python安装程序安装后,selenium将安装在 .... creating /usr/local/lib/python2.7/dist-packages/selenium-3.4.3-py2.7.egg Extracting selenium-3.4.3-py2.7.egg to /usr/local/lib/python2.7/dist-packages Adding selenium 3.4.3 to easy-install.pth file Install

提取.tar.gz并运行python安装程序安装后,selenium将安装在

....
creating /usr/local/lib/python2.7/dist-packages/selenium-3.4.3-py2.7.egg
Extracting selenium-3.4.3-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding selenium 3.4.3 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/selenium-3.4.3-py2.7.egg
.....
跑步时

python functionalTest.py 
它很好用

但是

给出,错误:

ModuleNotFoundError: No module named 'selenium'
因为我无法在Ubuntu上使用python3.6成功安装selenium,如下所示

$ ls setup*
setup.cfg  setup.py
$ python3.6 setup install
python3.6: can't open file 'setup': [Errno 2] No such file or directory
$ python3.6 setup.py install
Traceback (most recent call last):
  File "setup.py", line 22, in <module>
    from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'
.....
Original exception was:
Traceback (most recent call last):
  File "setup.py", line 22, in <module>
    from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'
$ 
问题:


如何配置python3.6来选择selenium?为什么尽管使用python3.6,selenium仍安装在/usr/local/lib/python2.7中?

看起来您已经安装了多个版本的Python。根据您提供的日志,您似乎已将Selenium安装到Python 2.7安装中

如果已使用命令python3.6将Python 3更改为在cmd中运行,则应通过执行以下操作来运行安装程序:

python3.6 setup install

您好,请运行:python3.6安装程序安装以安装用于python3.6的selenium,然后尝试运行为什么不使用pip?@Stack在说python3.6 setup.py安装时我收到错误,ModuleNotFoundError:setuptools导入的代码中没有名为“setuptools”的模块setup@AlexHallpip是否确保python3和2顺利拾取硒元素?@overexchange,您可以使用pip,尝试pip3安装selenium或python3.6-m pip安装selenium,它应该可以工作
$ python3.6 setup.py install
.....
creating /usr/local/lib/python2.7/dist-packages/selenium-3.4.3-py2.7.egg
Extracting selenium-3.4.3-py2.7.egg to /usr/local/lib/python2.7/dist-packages
selenium 3.4.3 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/selenium-3.4.3-py2.7.egg
Processing dependencies for selenium==3.4.3
Finished processing dependencies for selenium==3.4.3
$ cd /usr/local/lib/python
python2.7/ python3.5/ python3.6/ 
$ 
$ easy_install --version
setuptools 20.7.0 from /usr/lib/python2.7/dist-packages (Python 2.7)
$ pip --version
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
$
python3.6 setup install