提取.tar.gz并运行python setup install
之后,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
它工作得很好
但
python3.6 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'
$
编辑:
在安装setuptools之后,下面是观察,
$ 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来选择selenium?为什么selenium在/usr/local/lib/python2.7
中安装,尽管使用了python3.6
发布于 2017-06-30 12:54:58
看起来您已经安装了多个版本的Python。根据您提供的日志,您似乎已经在Python2.7安装中安装了Selenium。
如果使用命令"python3.6“将Python 3更改为在cmd中运行,则应该执行以下操作来运行设置:
python3.6 setup install
https://stackoverflow.com/questions/44854635
复制相似问题