pyvenv安装了错误的pip版本 [英] pyvenv installs wrong pip version

查看:115
本文介绍了pyvenv安装了错误的pip版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用pyvenv env创建virtualenv,但已安装的pip版本已过时.我可以在虚拟环境中手动更新pip,但我想自动获得正确的版本.

I'm creating a virtualenv with pyvenv env but the installed pip version is outdated. I can manually update pip in the virtual env but I would like to have the correct version automatically.

未激活venv:

~> pip -V
pip 7.1.2 from /usr/lib/python3.4/site-packages (python 3.4)

安装venv:

~> pyvenv env
~> source env/bin/activate.fish

激活venv:

~> pip -V
pip 6.0.8 from /home/syntonym/test/env/lib/python3.4/site-packages (python 3.4)

我正在使用arch,并且pip和pacman(arch数据包管理器)都对pip进行了管理,这可能不是一个好主意.我仍然不知道pyvenv从哪里获得6.0.8版本的pip或如何修复它.使用pacman重新安装没有帮助.

I'm using arch and have pip managed by both, pip and pacman (the arch packet manager), which is probably not a good idea. I still have no idea from where pyvenv gets a 6.0.8 version of pip or how to fix it. Reinstalling with pacman did not help.

ensurepip声称它已经是最新的:

ensurepip claims it's already up to date:

~> python -m ensurepip --upgrade
Ignoring indexes: https://pypi.python.org/simple
Requirement already up-to-date: setuptools in /usr/lib/python3.4/site-packages
Requirement already up-to-date: pip in /usr/lib/python3.4/site-packages

推荐答案

您可以通过执行

pip install -U pip

您正面临此问题,因为venv使用确保分组pip添加到新环境中:

You are facing this problem, because venv uses ensurepip to add pip into new environments:

除非给出--without-pip选项,否则将确保将调用 引导点进入虚拟环境.

Unless the --without-pip option is given, ensurepip will be invoked to bootstrap pip into the virtual environment.

Ensurepip软件包不会从Internet下载或从其他任何地方获取文件,因为软件包中已包含所有必需的组件.这样做会增加安全漏洞,因此不受支持.

Ensurepip package won't download from the internet or grab files from anywhere else, because all required components are already included into the package. Doing so would add security flaws and is thus unsupported.

Ensurepip并非旨在为您提供最新的pip,而只是为您提供"a" pip.要获得最新消息,请在本文开头使用手动方式.

Ensurepip is not designed to give you the newest pip, but just "a" pip. To get the newest one use the manual way at the beginning of this post.

这篇关于pyvenv安装了错误的pip版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆