简体   繁体   English

在 mac 上为 python3 安装 venv 时出错

[英]Error in installing venv for python3 on mac

While installing a virtual environment by running the following command on terminal:通过在终端上运行以下命令来安装虚拟环境时:

python3 -m pip install --user venv python3 -m pip 安装 --user venv

I'm encountering the following error:我遇到以下错误:

ERROR: Could not find a version that satisfies the requirement venv错误:找不到满足要求 venv 的版本
ERROR: No matching distribution found for venv错误:没有找到 venv 的匹配分布

Please help me with this.请帮我解决一下这个。 I believe since default python is version 2.x in macOS I must try installing virtualenv but I require venv.我相信由于默认 python 在 macOS 中是 2.x 版,我必须尝试安装 virtualenv 但我需要 venv。

You cannot install venv with pip : venv is a module from the standard library since Python 3.3.您不能使用pip venv venv是自 Python 3.3 以来标准库中的模块 So you don't need to install it, just start using:所以你不需要安装它,只需开始使用:

python3 -m venv path/to/new-venv

Venv doesn't exists. Venv 不存在。 I guess that you might want the package virtualenv .我猜你可能想要 package virtualenv

Venv is commonly used as the name of virtual environment created by virtualenv. Venv 通常用作 virtualenv 创建的虚拟环境的名称。

So, the command is:所以,命令是:

python3 -m pip install --user virtualenv
python3 -m virtualenv venv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM