无法使用Python3在Ubuntu上安装selenium

时间:2013-10-27 17:12:13

标签: python linux ubuntu selenium

我想在Python上使用Ulenntu上的selenium。我按照说明运行以下命令:

ubuntu:~$ sudo pip-3.2 install -U selenium
Downloading/unpacking selenium
  Downloading selenium-2.37.2.tar.gz (2.6MB): 2.6MB downloaded
  Running setup.py egg_info for package selenium

Installing collected packages: selenium
  Running setup.py install for selenium

Successfully installed selenium
Cleaning up...

但是当我尝试在python3中导入selenium模块时,我收到一个错误:

@ubuntu:~$ python3

    Python 3.2.5 (default, Sep  7 2013, 16:55:10) 
    [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

1 个答案:

答案 0 :(得分:3)

您可以通过以下步骤在Ubuntu和Python3上使用selenium:

  1. 使用sudo apt-get install python3-pip为python3安装pip
  2. 使用sudo python3 -m pip install -U selenium为python3安装selenium