在Windows上使用pip安装virtualenv时出错

时间:2018-05-04 13:07:12

标签: python windows python-2.7 pip virtualenv

尝试在Windows机器上使用pip安装virtualenv,但面临错误

pip install virtualenv
    Collecting virtualenv
    Exception:
    Traceback (most recent call last): File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main status = self.run(options, args)
    File "c:\python27\lib\site-packages\pip\commands\install.py", line 324, in run
    requirement_set.prepare_files(finder)
    File "c:\python27\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files ignore_dependencies=self.ignore_dependencies))
    File "c:\python27\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file session=self.session, hashes=hashes)
    File "c:\python27\lib\site-packages\pip\download.py", line 821, in unpack_url hashes=hashes
    File "c:\python27\lib\site-packages\pip\download.py", line 659, in unpack_http_url hashes)
    File "c:\python27\lib\site-packages\pip\download.py", line 853, in _download_http_url stream=True,
    File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 488, in get return self.request('GET', url, **kwargs)
    File "c:\python27\lib\site-packages\pip\download.py", line 386, in request return super(PipSession, self).request(method, url, *args, **kwargs)
    File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 475, in request resp = self.send(prep, **send_kwargs)
    File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 596, in send r = adapter.send(request, **kwargs)
    File "c:\python27\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 47, in send resp = super(CacheControlAdapter, self).send(request, **kw)
    File "c:\python27\lib\site-packages\pip\_vendor\requests\adapters.py", line 497, in send raise SSLError(e, request=request)
    SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
    You are using pip version 9.0.1, however version 10.0.1 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.

3 个答案:

答案 0 :(得分:0)

您是否尝试过使用cmd行作为管理员在下面运行,

pip install virtualenv

virtualenv带有一个pip副本,它被复制到你创建的每个新环境中,因此virtualenv就是所有需要的。您可以尝试将virtualenv作为独立包单独安装。这对Windows用户来说实际上更容易。有关说明,请参阅https://virtualenv.pypa.io/en/stable/

答案 1 :(得分:0)

您需要先升级PIP

python -m pip install --upgrade pip

然后您可以通过管理员访问

安装您的软件包
pip install virtualenv

答案 2 :(得分:0)

问题解决了! Python 2.7.13附带的pip存在问题,保存了这个文件(https://bootstrap.pypa.io/get-pip.py)然后命令'python get-pip.py'通过升级来解决问题。由于命令'python -m pip install --upgrade pip'本身给出了与上面提到的相同的错误。谢谢大家!