Virtualenwrapper
1. Introduction
Virtualenvwrapper is a set of extensions to Ian Bicking’s virtualenv tool. The extensions include wrappers for creating and deleting virtual environments and otherwise managing your development workflow, making it easier to work on more than one project at a time without introducing conflicts in their dependencies.
2. Installation
$ sudo pip install virtualenvwrapper
$ vim ~/.bashrc
    # add three lines
    export WORKON_HOME=$HOME/.virtualenvs
    export PROJECT_HOME=$HOME/Projects/Python
    source /usr/local/bin/virtualenvwrapper.sh
$ source ~/.bashrc
3. Command
3.1 mkvirtualenv
Create a new environment, in the WORKON_HOME.
mkvirtualenv [-a project_path] [-i package] [-r requirements_file] [virtualenv options] ENVNAME
# -a: associate an existing project directory with the new environment.
# -i: install one or more packages after the environment is created.
# -r: specify a text file listing packages to be installed.
3.2 mktmpenv
Create a new temporary virtualenv in the WORKON_HOME directory. A unique virtualenv name is generated.
mktmpenv [(-c|--cd)|(-n|--no-cd)] [VIRTUALENV_OPTIONS]
If -c or --cd is specified the working directory is changed to the virtualenv directory during the post-activate phase, regardless of the value of VIRTUALENVWRAPPER_WORKON_CD.
If -n or --no-cd is specified the working directory is not changed to the virtualenv directory during the post-activate phase, regardless of the value of VIRTUALENVWRAPPER_WORKON_CD.
3.3 lsvirtualenv
List all of the environments.
lsvirtualenv [-b] [-l] [-h]
# -b: Brief mode, disables verbose output.
# -l: Long mode, enables verbose output. Default.
# -h: Print the help for lsvirtualenv.
3.4 showvirtualenv
Show the details for a single virtualenv.
showvirtualenv [env]
3.5 rmvirtualenv
Remove an environment, in the WORKON_HOME.
rmvirtualenv ENVNAME
3.6 cpvirtualenv
Duplicate an existing virtualenv environment. The source can be an environment managed by virtualenvwrapper or an external environment created elsewhere.
cpvirtualenv ENVNAME [TARGETENVNAME]
3.7 allvirtualenv
Run a command in all virtualenvs under WORKON_HOME.
allvirtualenv command with arguments
3.8 workon
List or change working virtual environments
workon [(-c|--cd)|(-n|--no-cd)] [environment_name|"."]
If no environment_name is given the list of available environments is printed to stdout.
If -c or --cd is specified the working directory is changed to the project directory during the post-activate phase, regardless of the value of VIRTUALENVWRAPPER_WORKON_CD.
If -n or --no-cd is specified the working directory is not changed to the project directory during the post-activate phase, regardless of the value of VIRTUALENVWRAPPER_WORKON_CD.
If "." is passed as the environment name, the name is derived from the base name of the current working directory .
3.9 deactivate
Switch from a virtual environment to the system-installed version of Python.
deactivate
3.10 mkproject
Create a new virtualenv in the WORKON_HOME and project directory in PROJECT_HOME.
mkproject [-f|--force] [-t template] [virtualenv_options] ENVNAME
# -f, --force   Create the virtualenv even if the project directory already exists
# The template option may be repeated to have several templates used to create a new project. 
3.11 setvirtualenvproject
Bind an existing virtualenv to an existing project.
setvirtualenvproject [virtualenv_path project_path]
3.12 cdproject
Change the current working directory to the one specified as the project directory for the active virtualenv.
cdproject
3.13 wipeenv
Remove all of the installed third-party packages in the current virtualenv.
wipeenv
4. Examples
4.1 set python version
mkvirtualenv --python=/usr/bin/python3 ENVNAME
mkproject --python=/usr/bin/python3 ENVNAME												
											Virtualenwrapper的更多相关文章
- Ubuntu16.04怎么安装virtualenv虚拟环境
		
最近安装virtualenv的python虚拟环境,在网上找了很多,尝试了很多,都有各种问题,最终搞定后,给大家分享下我的过程,希望大家少走弯路. 本次安装是基于Ubuntu16.04Linux版本安 ...
 - Django打造大型企业官网
		
第1章 Django预热 1-为什么需要虚拟环境 2-virtualenv创建虚拟环境 3-virtualenvwrapper使用 4-URL组成部分讲解 5-课程准备工作 6-Django介绍 第2 ...
 - Django实现博客项目
		
一.项目概述 项目运行环境 Python3.6+ Django 1.11 MySQL 5.7 其他插件(图片处理.分页.验证码....) 项目详细功能介绍 前台功能 项目首页展示 轮播图 博客推荐 最 ...
 - ubuntu16.04安装python虚拟环境
		
自己也是搜的教程,亲测有效 ubuntu16.04创建虚拟环境 一.linux环境 Ubuntu16.04 二.安装和配置虚拟环境 安装虚拟环境 sudo pip install virtualenv ...
 
随机推荐
- HDU 5379 Mahjong tree(树的遍历&组合数学)
			
本文纯属原创,转载请注明出处.谢谢. http://blog.csdn.net/zip_fan 题目传送门:http://acm.hdu.edu.cn/showproblem.php? pid=537 ...
 - 【BZOJ3065】带插入区间K小值 替罪羊树+权值线段树
			
[BZOJ3065]带插入区间K小值 Description 从前有n只跳蚤排成一行做早操,每只跳蚤都有自己的一个弹跳力a[i].跳蚤国王看着这些跳蚤国欣欣向荣的情景,感到非常高兴.这时跳蚤国王决定理 ...
 - EasyNVR H5无插件摄像机直播解决方案前端解析之:引用videojs无法自动播放
			
关于videojs自动播放问题 播放流媒体多使用videojs来进行播放,videojs,本身自带自动播放属性: 通过添加autoplay(),来完成视频播放的自动加载: player = video ...
 - ast.literal_eval(jsonStr) json格式字符串转dict 2种方式
			
json.loads(jsonStr, encoding='utf-8')import ast ast.literal_eval(jsonStr)
 - SecureCRT 会话设置项
			
登陆动作------自动登陆仿真------两个颜色复选框都勾上模式------光标键模式(2个复选框)映射键------使用windows复制和粘贴热键外观------字符编码:UTF-8外观--- ...
 - ubuntu 下解决sublime v3 中文输入法时 退格键删除不了拼音的问题
			
ubuntu下,sulime想要支持中文需要这样设置: 1.安装中文输入解决的github git clone https://github.com/lyfeyaj/sublime-text-imfi ...
 - flex做页面。用来做视频的后台服务器是fms
			
作为新一代的富客户端互联网技术的佼佼者,Flex这种技术已经被越来越多的公司所采用,被越来越多的用户和程序员所接受.以下列出Flex十大优势: 1.Flex与Flash:可以让普通程序员开发制作Fla ...
 - 解决MAC Appium设备连不上IOS的的问题'idevice_id' program is not installed
			
解决MAC Appium设备连不上IOS的的问题 错误的: [XCUITest] The 'idevice_id' program is not installed. If you are runni ...
 - Linux下监视GPU、CPU的使用情况
			
1.在运行Tensorflow等程序时会使用到NVIDIA的GPU,所以在程序运行时需要监控GPU的运行情况 使用 nvidia-smi 命令 ,显示如下: nvidia-smi 显示解读: GPU: ...
 - HDU - 2612 Find a way  【BFS】
			
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=2612 题意 有两个人 要去一个城市中的KFC 一个城市中有多个KFC 求两个人到哪一个KFC的总时间最 ...