This is a port of Doug Hellmann's virtualenvwrapper to Windows batch scripts. The idea behind virtualenvwrapper is to ease usage of Ian Bicking's virtualenv, a tool for creating isolated Python virtual environments, each with their own libraries and site-packages.
These scripts should work on any version of Windows (Windows XP, Windows Vista, Windows 7/8/10).
However, they only work in the regular command prompt. They will not work in Powershell. There are other virtualenvwrapper projects out there for Powershell.
For Windows only
To use these scripts from any directory, make sure the Scripts
subdirectory of Python is in your PATH. For example, if python is installed in C:\Python27\
, you should make sure C:\Python27\Scripts
is in your PATH.
To install, run one of the following:
# using pip pip install virtualenvwrapper-win # using easy_install easy_install virtualenvwrapper-win # from source git clone git://github.com/davidmarble/virtualenvwrapper-win.git cd virtualenvwrapper-win python setup.py install # or pip install .
Add an environment variable WORKON_HOME to specify the path to store environments. By default, this is %USERPROFILE%\Envs
.
pywin python version switcher (not included)
If you use several versions of python, you can switch between them using a separate project pywin. It's a lightweight python 2.5-3.3 launcher and switcher I wrote for the Windows command line and MSYS/MINGW32. It's similar to the py.exe launcher/switcher available in python 3.3, but written with basic Windows batch scripts and a shell script for MSYS/MINGW32 support. I use bash and command line shell tools from msysgit, based on MSYS/MINGW32, to do most of my python development on Windows.
mkvirtualenv [mkvirtualenv-options] [virtualenv-options] <name>
Create a new virtualenv environment named <name>. The environment will be created in WORKON_HOME.
mkvirtualenv
options:
any other options are passed on to the virtualenv
command. For recent versions of virtualenv
, the -p
/ --python
can take version numbers instead of the full path to the interpreter, e.g. mkvirtualenv -p3.5 <name>
(assuming you have a Python 3.5.x interpreter installed).
lsvirtualenv
rmvirtualenv <name>
workon [<name>]
deactivate
add2virtualenv <full or relative path>
virtualenv_path_extensions.pth
inside the environment's site-packages, which effectively adds <path> to the environment's PYTHONPATH. If a virtualenv environment is not active, appends <path> to virtualenv_path_extensions.pth
inside the default Python's site-packages. If <path> doesn't exist, it will be created.
cdproject
cd-
will return you to the last directory you were in before calling cdproject
.
cdsitepackages
cd-
will return you to the last directory you were in before calling cdsitepackages
.
cdvirtualenv
cd-
will return you to the last directory you were in before calling cdvirtualenv
.
lssitepackages
add2virtualenv
).
mkproject
setprojectdir <full or relative path>
cdproject
to change the working directory. In addition, the directory will be added to the environment using add2virtualenv
. If <path> doesn't exist, it will be created.
toggleglobalsitepackages
whereis <file>
whereis python
to find all executables starting with python
or whereis python.exe
for an exact match.
virtualenvwrapper
To run some commands after mkvirtualenv
you can use hooks. First you need to define VIRTUALENVWRAPPER_HOOK_DIR
variable. If it is set mkvirtualenv
will run postmkvirtualenv.bat
script from that directory.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4