开始学习
< 返回

Python 虚拟环境

本文以 Python3.7 为例,介绍如何安装 Python 虚拟环境。

实际上,Python3.7 已经包含了 venv 模块,如果没有,在 Ubuntu 中可以执行下面命令安装 venv 模块。

sudo apt install python3-venv

接着,执行如下命令即可创建虚拟环境。

python3.7 -m venv py37-venv

激活虚拟环境

source py37-venv/bin/activate

推出虚拟环境

deactivate
Was this article helpful?
5 out of 5 stars

1 rating

5 Stars 100%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
Please Share Your Feedback
How Can We Improve This Article?
文章目录