提取.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?尽管使用/usr/local/lib/python2.7
?
python3.6
中安装了selenium
答案 0 :(得分:1)
看起来您安装了多个版本的Python。根据您提供的日志,您似乎已将Selenium安装到Python 2.7安装中。
如果您已使用命令&#34; python3.6&#34;更改了Python 3以在cmd中运行然后你应该通过执行以下操作来运行设置:
python3.6 setup install