使用python 3.3时是否需要python包virtualenv? [英] Is python package virtualenv necessary when I use python 3.3?

查看:35
本文介绍了使用python 3.3时是否需要python包virtualenv?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看 Cristoph Gohlke 的 python 包,我注意到有适用于 Python 3.3 的 Virtualenv 包.

I was looking in Cristoph Gohlke's python packages and I noticed that there is a package Virtualenv for Python 3.3.

由于标准python库v3.3中有venv包,我想知道单独安装这个包是否有优势.

Since there is a package venv in the standard python library v3.3, I was wondering if there is an advantage to install this package separately.

从两个包的文档中,virtualenv 1.8.2venv 我可以说 venv 标准库包缺少以下功能:

From the documentation of both packages, virtualenv 1.8.2 and venv I can say that the venv standard library package lacks the functionality of:

  1. --no-site-packages 选项
  2. 在设置工具或分发之间进行选择
  3. 无法安装 pip,因为它在默认的 python 安装中不可用
  4. 在虚拟环境中没有自定义提示前缀--prompt=PROMPT

如果还有其他我无法发现的差异,请写在这里.

If there are any other differences that I was unable to spot, please write them here.

推荐答案

一般来说,使用 python3.3 或更高版本时,virtualenv 包是不需要的,因为它是通过 PEP 405.正如您在问题中所指出的,最新版本的 virtualenv 与标准库中的 venv 包之间存在一些相对较小的差异.在某种程度上(例如 --no-site-packages),这源于不同的实现.由于 venv 位于标准库中,因此它不必跳过 virtualenv 所做的一些扭曲的箍环以创建自包含的 Python 安装,例如复制大部分 python 的 site 模块.

Generally, the virtualenv package is not required when using python3.3 or later, since it was incorporated into the standard library via PEP 405. As you note in the question, there are some relatively small differences between the latest versions of virtualenv and the venv package in the standard library. In part (e.g. --no-site-packages) this stems from the different implementations. Since venv is in the standard library, it doesn't have to jump through some of the contorted hoops that virtualenv does in order to create a self-contained python installation, such as copying much of python's site module.

最好的资源是认真阅读 PEP.

The best resource is really to read the PEP thoroughly.

这篇关于使用python 3.3时是否需要python包virtualenv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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