2012-03-01 144 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