- Published on
Python `virtualenv`
- Authors

- Name
- Daisuke Kobayashi
- https://twitter.com
These are my notes from setting up Python virtualenv.
Installation
mkdir ~/.pve source ~/.pve/python27/bin/activate (python27)$
To leave the environment, run the following command.
$ deactivate
If you want to create a virtual environment for a specific Python version, pass the path to python.exe with the -p option.
$ virtualenv ~/.pve/python33 -p C:\Python33\python.exe
Dependency on the shell environment
virtualenv depends on the shell environment from which it is executed. If you run it from PowerShell, you need to change the execution policy. Start PowerShell and run the following command.
Set-ExecutionPolicy RemoteSigned
Installing packages from EXE installers
When installing packages such as numpy and scipy on Windows, I install them from .exe files. pip tries to build them from source, which makes compilation and dependency handling troublesome, so this is easier. If you download them from SourceForge, the file names should look something like the following.
numpy-x.x.x-win32-superpack-pythonx.x.exe scipy-0.13.2-win32-superpack-pythonx.x.exe
If you extract those files with 7-Zip, they are split into files like these.
numpy-x.x.x-nosse.exe numpy-x.x.x-sse2.exe numpy-x.x.x-sse3.exe
Choose the .exe that matches your CPU architecture and install it with the following command.
easy_install numpy-x.x.x-sse3.exe