Python selenium lib没有安装在Windows上

时间:2011-03-31 15:49:07

标签: python windows-7 selenium

尝试在Windows 7计算机上安装Selenium的python库:

我明白了:

------------------------------------------------------------
C:\Python27\Scripts\pip-script.py run on 03/31/11 11:44:21
Downloading/unpacking selenium
Exception:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip-0.8.3-py2.7.egg\pip\basecommand.py", line 127, in main
    self.run(options, args)
  File "C:\Python27\lib\site-packages\pip-0.8.3-py2.7.egg\pip\commands\install.py", line 223, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\Python27\lib\site-packages\pip-0.8.3-py2.7.egg\pip\req.py", line 936, in prepare_files
    location = req_to_install.build_location(self.build_dir, not self.is_download)
  File "C:\Python27\lib\site-packages\pip-0.8.3-py2.7.egg\pip\req.py", line 147, in build_location
    _make_build_dir(build_dir)
  File "C:\Python27\lib\site-packages\pip-0.8.3-py2.7.egg\pip\req.py", line 1177, in _make_build_dir
    os.makedirs(build_dir)
  File "C:\Python27\lib\os.py", line 157, in makedirs
    mkdir(name, mode)
WindowsError: [Error 5] Access is denied: 'C:\\Windows\\System32\\build'

2 个答案:

答案 0 :(得分:4)

WindowsError: [Error 5] Access is denied: 'C:\\Windows\\System32\\build'

嗯,这句话说你无法访问C:\Windows\System32\。通常情况下,您不是管理员。

尝试从管理员帐户运行pip

  1. 按Windows徽标(技术名称)。
  2. 输入“ cmd ”。
  3. 右键点击“ cmd.exe ”,然后点击“以管理员身份运行”。
  4. 与UAC合作。
  5. 现在尝试运行pip

答案 1 :(得分:1)

从您有权访问的目录安装:

pushd %USERPROFILE%
pip install selenium

或者,您可以获得预先构建的包via PyPM