python独立环境——virtualenv

安装:

  1. pip3 intall virtualenv
 

创建独立运行环境:

1. 进入项目文件夹根目录

2. 创建环境

  1. Mac:myproject michael$ virtualenv --no-site-packages venv
  2. Using base prefix \'/usr/local/.../Python.framework/Versions/3.4\'
  3. New python executable in venv/bin/python3.4
  4. Also creating executable in venv/bin/python
  5. Installing setuptools, pip, wheel...done.
3. --no-site-packages参数,不拷贝已经安装到系统中的第三方包
 
 
进入独立运行环境:
  1. Mac:myproject michael$ source venv/bin/activate
  2. (venv)Mac:myproject michael$
 
退出独立运行环境:
  1. (venv)Mac:myproject michael$ deactivate
  2. Mac:myproject michael$
 

 





posted @ 2017-01-23 12:25  测试散人  阅读(881)  评论(0编辑  收藏  举报