问题描述
我在virtualenv中安装 pytz 时遇到问题.
I have a problem installing pytz in virtualenv.
最新版本的pip似乎有问题.
It seems like it's a problem with the latest version of pip.
有什么解决方法吗?
推荐答案
由于行为的这种变化,使用pip v1.4或更高版本安装pytz
时会发生此错误:
This error occurs when installing pytz
using pip v1.4 or newer, due to this change in behaviour:
如果需求说明符包含预发布或开发版本(例如>=0.0.dev0
),则pip将允许该需求的预发布和开发版本.这不包括!=
标志.
If a Requirement specifier includes a pre-release or development version (e.g. >=0.0.dev0
) then pip will allow pre-release and development versions for that requirement. This does not include the !=
flag.
pip install
命令还支持--pre
标志,该标志将允许安装预发行版和开发发行版.
The pip install
command also supports a --pre
flag that will enable installing pre-releases and development releases.
pytz
软件包的版本标识符的格式类似于2013b
. PEP426 使用 PEP440 ,它指定:
The version identifiers for the pytz
package have a format like 2013b
. PEP426 uses the version identifiers described in PEP440, which specifies that:
N[.N]+[{a|b|c|rc}N][.postN][.devN]
由于像2013b
这样的pytz
版本与此格式不匹配,因此pip 1.4+版将pytz
的所有版本视为预发行版本,并且未安装它们默认情况下.
Because the pytz
versions like 2013b
do not match this format, version 1.4+ of pip is treating all versions of pytz
as pre-release versions, and is not installing them by default.
如果仅安装pytz
,则可以使用--pre
标志来避免这种行为,但是您不想使用此标志来安装整个项目的要求:某些软件包的发行版可能不稳定您不想要的版本.在这种情况下,请使用上述行为:如果为程序包指定预发行"版本号,则pip将搜索程序包的预发行"版本.所以我已将其添加到我的requirements.txt
:
If you are only installing pytz
, you can use the --pre
flag to avoid this behaviour, but you wouldn't want to use this flag for installing your entire project's requirements: some packages might have unstable pre-release versions you don't want. In that case, use the behaviour described above: if you specify a "pre-release" version number for the package, then pip will search for "pre-release" versions of the package. So I've added this to my requirements.txt
:
pytz>=2013b
升级软件包时,pip现在将正确搜索并安装最新版本的pytz
.
When I upgrade my packages, pip will now correctly search for and install the latest version of pytz
.
此问题已在pytz错误跟踪器中以 issue#1204837的形式归档,并且第974号问题.
This has been filed as issue #1204837 in the pytz bug tracker and issue #974 in the pip bug tracker.
停止按下:如 PyTz错误报告,现在pytz的版本号已更改为例如2013.7-因此,一旦升级到该版本,就不会再出现此问题.
Stop Press: As described in the PyTz bug report, the version numbering of pytz has now been changed to, for example, 2013.7 - so once you have upgraded to this, the problem should no longer occur.
这篇关于找不到满足pytz要求的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!