2012-03-01 122 views

回答

26

您需要启用virtualenvwrapper,如its docs中所述。

Shell Startup File

Add three lines to your shell startup file (.bashrc , .profile , etc.) to set the location where the virtual environments should live, the location of your development project directories, and the location of the script installed with this package:

export WORKON_HOME=$HOME/.virtualenvs 
export PROJECT_HOME=$HOME/Devel 
source /usr/local/bin/virtualenvwrapper.sh 

After editing it, reload the startup file (e.g., run source ~/.bashrc).

3

取决于你如何安装呢?这实际上可以改变一点点。如果你使用apt将它安装在Ubuntu上,那么virtualenvwrapper函数实际上会被放入一个bash完成文件(找出它很有趣!)。

export WORKON_HOME=$HOME/.virtualenvs 
export PROJECT_HOME=$HOME/Devel 
possible_scripts='/usr/local/bin/virtualenvwrapper.sh /etc/bash_completion.d/virtualenvwrapper' 
for script in $possible_scripts; do 
    [[ -f $script ]] && source $script 
done