目录
Python虚拟环境
在开发python应用程序的时候,系统安装的python3只有一个版本:3.4。所有的第三方的包都回被pip安装到python3的site-packages目录下。
如果我们要要同时开发多个应用程序,那这些应用都共用一个python,就是安装在系统的python3。如果应用A需要jinja 2.7,而应用B需要jinja 2.6怎么办?
这种情况下,每个应用需要各自拥有一套“独立”的python运行环境。
有两个常用工具用于创建python“独立”环境:
- venv is available by default in Python 3.3 and later, and installs pip and setuptools into created virtual environments in Python 3.4 and later.
- virtualenv needs to be installed separately, but supports Python 2.7+ and Python 3.3+, and pip, setuptools and wheel are always installed into created virtual environments by default (regardless of Python version).
1、virtualenv
https://virtualenv.readthedocs.io/en/latest/
virtualenv is a tool to create