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 ...
随机推荐
- Linux命令apt-get apt的常见用法
高级包装工具(英语:Advanced Packaging Tools,缩写为APT) apt-cache search foo //搜索和"foo"匹配的包. apt-cache ...
- 之前博客中的代码都放到github上
之前一直把代码托管在taocode上,现在已经不能用了,所以把代码整理了一下,统一都放在gibhub上了. LALR(1)语法分析生成器:https://github.com/kiven-li/xby ...
- scrapy架构解析
- 九度OJ 1022:游船出租 (统计)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3670 解决:1444 题目描述: 现有公园游船租赁处请你编写一个租船管理系统.当游客租船时,管理员输入船号并按下S键,系统开始计时 ...
- cordova 实现拨打电话-只需两步(H5)
cordova 实现拨打电话: 第一步配置conf.xml在cordova中所有的URL Schemes 都是服从于白名单的,所以a tel 在这无法正常使用.解决方法是在项目config.xml中添 ...
- Java for LeetCode 114 Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 ...
- Wannafly挑战赛12 B T95要减肥 【贪心】
链接:https://www.nowcoder.com/acm/contest/79/B 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言5242 ...
- Python环境问题
http://installion.co.uk/ubuntu/precise/main/p/python3.2/uninstall/index.html
- webpack笔记1
1.设置多个入口起点 多用于提取公共类库 a.利用commonChunkPlugin const webpack= require('webpack'); const path = require(' ...
- make和rest用法
位置(position):下一个要读取或写入的数据的索引.缓冲区的位置不能为负,并且不能大于其限制(limit). 标记(mark)与重置(reset):标记是一个索引,通过Buffer中的mark( ...