本文介绍了在 Python3.3 中使用 virtualenvwrapper 是否意味着我不能(或不应该)使用 pyvenv?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Virtualenvwrapper 是一个围绕 Python virtualenv 的用户友好外壳.

Virtualenvwrapper is a user-friendly shell around Python's virtualenv.

Python 3.3 在标准库中内置了 pyvenv,旨在取代 virtualenv.

Python 3.3 ships with pyvenv built into the standard library, which aims to supercede virtualenv.

但是如果我在 Python3.3 上安装 Virtualenvwrapper,它仍然会安装 virtualenv,这让我相信它不会在幕后使用pyvenv".

But if I install Virtualenvwrapper on Python3.3, it still installs virtualenv, leading me to believe it doesn't use 'pyvenv' under the covers.

大概这并不重要 - 如果我想在 Python3.3 上使用 virtualenvwrapper,我应该很高兴让它使用 virtualenv 而不是 pyvenv,并且(目前)不会受到不良影响吗?

Presumably this doesn't really matter - if I wish to use virtualenvwrapper on Python3.3 I should happily let it use virtualenv instead of pyvenv, and will (for the moment) suffer no ill effects?

推荐答案

抱歉这个回答有点延迟.pyvenv 不是旨在取代 virtualenv,实际上 Python 3 中的 virtualenv 依赖于标准库 venv 模块.

Sorry this answer is a bit delayed. pyvenv does not aim to supersede virtualenv, in fact virtualenv in Python 3 depends on the standard library venv module.

pyvenv 命令创建一个绝对最小的虚拟环境,其他软件包可以安装到其中.

The pyvenv command creates an absolutely minimal virtual environment into which other packages can be installed.

virtualenv 的 Python 3 版本实际上子类化了标准库的实现,并提供了自动将 setuptools 和 pip 安装到环境中的钩子,而 pyvenv 不会自行完成.

The Python 3 version of virtualenv actually subclasses the standard library's implementation and provides hooks to automatically install setuptools and pip into the environment which pyvenv doesn't do on it's own.

据我所知 virtualenvwrapper 仅依赖于 virtualenv,因为 mkvirtualenv 或 mkproject 命令允许您指定要安装到新环境中的包,这仅有效,因为 virtualenv 已经安装了 setuptools 和点.

As far as I know virtualenvwrapper depends on virtualenv only because the mkvirtualenv or mkproject commands allow you to specify packages to be installed into the new environment, this only works because virtualenv will have already installed setuptools and pip.

所以为了回答你的问题,我相信你应该能够在 pyvenv 创建的环境中使用 virtualenvwrapper,只要你遵循 virtualenvwrapper 的关于放置东西的约定,你要么手动安装 setuptools 和 pip 到环境中,要么不使用virtualenvwrapper 的任何包管理功能.

So to answer your question I believe you should be able to use virtualenvwrapper on environments created by pyvenv as long as you follow virtualenvwrapper's conventions for where to put things and you either manually install setuptools and pip into the environment or don't use any package management features of virtualenvwrapper.

这篇关于在 Python3.3 中使用 virtualenvwrapper 是否意味着我不能(或不应该)使用 pyvenv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-04 23:12