0
点赞
收藏
分享

微信扫一扫

Python:使用 venv 来创建虚拟环境


Python文档有如下的介绍:


Python 在 3.5 版更改: 现在推荐使用 venv 来创建虚拟环境


# 创建名为 .venv 的虚拟环境
python3 -m venv .venv

# 激活虚拟环境
source .venv/bin/activate

# 退出虚拟环境
deactivate

查看当前目录的文件

$ tree -a
.
└── .venv
├── bin
│ ├── activate
│ ├── activate.csh
│ ├── activate.fish
│ ├── python -> python3
│ └── python3 -> /Users/.pyenv/versions/py370/bin/python3
├── include
├── lib
│ └── python3.7
│ └── site-packages
└── pyvenv.cfg


参考
​​​​https://docs.python.org/zh-cn/3/library/venv.html​​​​




举报

相关推荐

0 条评论