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 ...
随机推荐
- 异常: 2 字节的 UTF-8 序列的字节 2 无效。
具体异常: 十二月 08, 2015 7:16:55 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.servi ...
- Easy AR简单教程
Easy AR简单教程 相关SDK资源下载链接:http://pan.baidu.com/s/1dERtCWD 密码:o0jd 1.ImageTarget的制作 (1).导入EasyARSD包,删 ...
- phpstudy nginx下curl请求本地其他项目
curl 请求的时候 如果用post请求,传递参数为 数组的时候 header 头 会被设置为 multipart/form-data 如果是字符串 形式 header 头会被设置为applica ...
- AOS应用基础平台-模块开发流程
AOS平台简单介绍 AOS应用基础平台基于JavaEE技术体系,以"标准功能可复用.通用模块可配置.行业需求高速开发.异构系统无缝集成"为目标.为软件开发团队提供高效可控.随需应变 ...
- Tensorflow教程
中文社区 tensorflow笔记:流程,概念和简单代码注释 TensorFlow入门教程集合 tensorboard教程:2017 TensorFlow 开发者峰会 TensorBoard轻松实践 ...
- 【BZOJ4653】[Noi2016]区间 双指针法+线段树
[BZOJ4653][Noi2016]区间 Description 在数轴上有 n个闭区间 [l1,r1],[l2,r2],...,[ln,rn].现在要从中选出 m 个区间,使得这 m个区间共同包含 ...
- 计算机网络--DNS
1.域名系统DNS(domain name system)是因特网使用的命名系统,用来把便于人们时用的机器名字转换为IP地址.因特网的域名系统DNS被设计成一个联机分布式数据库系统,并采用客户服务器方 ...
- apache功能优化
隐藏Apache版本等敏感信息 $ grep Server /usr/local/httpd/conf/extra/httpd-default.conf|grep -v "#" 修 ...
- VirtualBox创建VM结果ProcessorType是空的
用WMI来查询CPU的频率,一直没问题: "Select MaxClockSpeed From Win32_Processor Where ProcessorType = 3" 结 ...
- px sp dp 手机尺寸