简述
virtaulenvwrapper是virtualenv的扩展包,可以更方便地新增,删除,复制,切换虚拟环境。
官方说明:https://bitbucket.org/dhellmann/virtualenvwrapper/src/master/README.txt
.. -*- mode: rst -*-
#################
virtualenvwrapper
#################
virtualenvwrapper is a set of extensions to Ian Bicking's `virtualenv
<http://pypi.python.org/pypi/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.
**Warning:** The 4.x release includes some potentially incompatible
changes for extensions from 3.x. The python modules for extensions are
now *always* run with ``PWD=$WORKON_HOME`` (previously the value of
PWD varied depending on the hook). The *shell* portion of any hook
(anything sourced by the user's shell when the hook is run) is still
run in the same place as before.
========
Features
========
1. Organizes all of your virtual environments in one place.
2. Wrappers for creating, copying and deleting environments, including
user-configurable hooks.
3. Use a single command to switch between environments.
4. Tab completion for commands that take a virtual environment as
argument.
5. User-configurable hooks for all operations.
6. Plugin system for more creating sharable extensions.
Rich Leland has created a short `screencast
<http://mathematism.com/2009/07/30/presentation-pip-and-virtualenv/>`__
showing off the features of virtualenvwrapper.
============
Installation
============
See the `project documentation
<http://www.doughellmann.com/docs/virtualenvwrapper/>`__ for
installation and setup instructions.
===============
Python Versions
===============
virtualenvwrapper is tested under Python 2.6 - 3.6.
===============
Shell Aliases
=============
Since virtualenvwrapper is largely a shell script, it uses shell
commands for a lot of its actions. If your environment makes heavy
use of shell aliases or other customizations, you may encounter
issues. Before reporting bugs in the bug tracker, please test
*without* your aliases enabled. If you can identify the alias causing
the problem, that will help make virtualenvwrapper more robust.
virtualenvwrapper的使用方法
Setup:
1. Create a directory to hold the virtual environments.
(mkdir $HOME/.virtualenvs).
创建一个文件夹叫做`.virtualenvs`用来存放所有的虚拟环境,即以后创建的所有虚拟环境都会放在一个文件夹里
2. Add a line like "export WORKON_HOME=$HOME/.virtualenvs"
to your .bashrc.
将刚才创建的文件夹加入到系统的环境变量中
3. Add a line like "source /path/to/this/file/virtualenvwrapper.sh"
to your .bashrc.
4. Run: source ~/.bashrc
5. Run: workon
6. A list of environments, empty, is printed.
7. Run: mkvirtualenv temp
8. Run: workon
9. This time, the "temp" environment is included.
10. Run: workon temp
11. The virtual environment is activated.
网友评论