python虚拟环境创建和激活

1、创建虚拟环境
$ mkdir work $ python3 -m venv work/ # 查看虚拟环境目录结构 $ cd work $ ls bin include
lib lib64 pyvenv.cfg share# 查看虚拟环境配置 $ vi pyvenv.cfg
-------------------------------------- home =/usr/bin include
-system-site-packages =false version = 3.5.2
--------------------------------------
2、激活虚拟环境
$ cd work $ source bin/activate # 前面有括号xx,即表示虚拟环境激活成功,在激活环境下pip安装的包单独管理,不会冲突
(work) $
3、退出虚拟环境
(work) $ deactivate