“virtualenv"和“virtualenv"有什么区别?和“-m venv"在创建虚拟环境(Python) [英] What's the difference between "virtualenv" and "-m venv" in creating Virtual environments(Python)

查看:27
本文介绍了“virtualenv"和“virtualenv"有什么区别?和“-m venv"在创建虚拟环境(Python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,如果我听起来有点愚蠢.我对此感到困惑两者有什么区别
virtualenv myvenv

-m venv myvenv
第一个对我来说很适合创建虚拟环境,而另一个则不行.
我 CD 进入我的开发目录并使用virtualenv myvenv"并创建虚拟环境.但是如果我使用 "-m venv myvenv" 它只会给出错误.请帮我理解

Sorry if I sound a bit foolish. I'm confused about this what's the difference between the two
virtualenv myvenv
and
-m venv myvenv
The first one works well for me in creating virtual environments while the other does not.
I CD into my development directory and use "virtualenv myvenv" and it creates the virtual environment. But if I use "-m venv myvenv" it just gives errors. Please help me understand

推荐答案

venv 是 python 3 直接附带的包.所以你不需要 pip install任何事物.

venv is a package shipped directly with python 3. So you don't need to pip install anything.

virtualenv 而是在 https://virtualenv 上提供的独立库.pypa.io/en/stable/ 并且可以使用 pip 安装.

virtualenv instead is an independent library available at https://virtualenv.pypa.io/en/stable/ and can be install with pip.

它们解决相同的问题,并以非常相似的方式工作.

They solve the same problem and work in a very similar manner.

如果您使用 python3,我建议避免额外"依赖,并坚持使用 venv

If you use python3 I suggest to avoid an "extra" dependancy and just stick with venv

你的错误可能是因为你使用了 Python2/pip2

Your error is probably because you use Python2/pip2

这篇关于“virtualenv"和“virtualenv"有什么区别?和“-m venv"在创建虚拟环境(Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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