pyenv-virtualenv is a pyenv plugin
that provides a pyenv virtualenv
command to create virtualenv for Python
on UNIX-like systems.
(NOTICE: If you are an existing user of virtualenvwrapper and you love it, pyenv-virtualenvwrapper may help you to manage your virtualenvs.)
Installing pyenv-virtualenv as a pyenv plugin will give you access to the
pyenv virtualenv
command.
$ git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
$ exec "$SHELL"
This will install the latest development version of pyenv-virtualenv into
the ~/.pyenv/plugins/pyenv-virtualenv
directory.
Important note: If you installed pyenv into a non-standard directory, make sure that you clone this
repo into the 'plugins' directory of wherever you installed into.
From inside that directory you can:
- Check out a specific release tag.
- Get the latest development release by running
git pull
to download the latest changes.
Mac OS X users can install pyenv-virtualenv with the
Homebrew package manager. This
will give you access to the pyenv-virtualenv
command. If you have pyenv
installed, you will also be able to use the pyenv virtualenv
command.
This is recommended method of installation if you installed pyenv with Homebrew.
brew install pyenv-virtualenv
Or, if you would like to install the latest development release:
brew install --HEAD pyenv-virtualenv
To create a virtualenv for the Python version use with pyenv, run
pyenv virtualenv
, specifying the Python version you want and the name
of the virtualenv directory. For example,
$ pyenv virtualenv 2.7.6 my-virtual-env-2.7.6
will create a virtualenv based on Python 2.7.6
under ~/.pyenv/versions
in a folder called my-virtual-env-2.7.6
.
If there is only one argument is given to pyenv virtualenv
,
virtualenv will be created with given name based on current
version.
$ pyenv version
3.3.3 (set by /home/yyuu/.pyenv/version)
$ pyenv virtualenv venv33
pyenv virtualenvs
shows you the list of existing virtualenvs.
$ pyenv shell venv27
$ pyenv virtualenvs
* venv27 (created from /home/yyuu/.pyenv/versions/2.7.6)
venv33 (created from /home/yyuu/.pyenv/versions/3.3.3)
Some external tools (e.g. jedi) might require you to activate
the virtualenv.
pyenv activate
lets you to activate the virtualenv into your shell.
$ pyenv activate venv27
pyenv activate
acts almost like following commands.
The activate'd virtualenv will be persisted as shell version.
$ pyenv shell venv27
$ source "$(pyenv prefix venv27)/bin/activate"
You can deactivate
the activate'd virtualenv by pyenv deactivate
.
$ pyenv deactivate
Or, there is an alias in activate
command.
This is prepared for similality between other pyenv
commands like shell
and local
.
$ pyenv activate --unset
pyenv deactivate
acts almost like following commands.
You can also use virtualenv's deactivate
in place of pyenv deactivate
,
but be careful with the shell version because it will be persisted even if deactivate
has invoked.
$ deactivate
$ pyenv shell --unset
You can set certain environment variables to control the pyenv-virtualenv.
PYENV_VIRTUALENV_CACHE_PATH
, if set, specifies a directory to use for caching downloaded package files.VIRTUALENV_VERSION
, if set, forces pyenv-virtualenv to install desired version of virtualenv. If the virtualenv has not been installed, pyenv-virtualenv will try to install the given version of virtualenv.EZ_SETUP
andGET_PIP
, if set and pyvenv is preferred than virtualenv, useez_setup.py
andget_pip.py
at specified location.EZ_SETUP_URL
andGET_PIP_URL
, if set and pyvenv is preferred than virtualenv, downloadez_setup.py
andget_pip.py
from specified URL.SETUPTOOLS_VERSION
andPIP_VERSION
, if set and pyvenv is preferred than virtualenv, install specified version of setuptools and pip.
- Add
activate
anddeactivate
to makepyenv-virtualenv
work with jedi (#9) - Use
ensurepip
to installpip
if it is available - Unset
PIP_REQUIRE_VENV
to avoid problem on the installation ofvirtualenv
(#10) - Add tests
- Fix install script
- Support environment variables of
EZ_SETUP
andGET_PIP
. - Support a short option
-p
ofvirtualenv
.
- Use latest release of setuptools and pip if the version not given via environment variables.
- Removed bundled
virtualenv.py
script. Now pyenv-virtualenv installsvirtualenv
package into source version and then use it. - On Python 3.3+, use
pyvenv
as virtualenv command ifvirtualenv
is not available. - Install setuptools and pip into environments created by
pyvenv
.
- Add
pyenv virtualenvs
to list all virtualenv versions. - EXPERIMENTAL: Add
--upgrade
option to re-create virtualenv with migrating packages
- Remove
python-virtualenv
which was no longer used. - Change the installation path of the
virtualenv.py
script. (./libexec
->./libexec/pyenv-virtualenv/${VIRTUALENV_VERSION}
) - Download
virtualenv.py
if desired version has not been installed.
- Display virtualenv information in
--help
and--version
- Update virtualenv version; 1.8.4 -> 1.9.1
- Rename the project;
s/python-virtualenv/pyenv-virtualenv/g
- The
pyenv-virtualenv
script is not depending onpython-virtualenv
now.python-virtualenv
will left for compatibility and will not continue for future releases. - Update virtualenv version; 1.8.2 -> 1.8.4
- Add pyenv 0.2.x (rbenv 0.4.x) style help messages.
- Create virtualenv with exact name of python executables.
- Changed command-line options of python-virtualenv. First argument should be a path to the python executable.
- Add install script.
- Initial public release.
(The MIT License)
- Copyright (c) 2013 Yamashita, Yuu
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.