2012-03-01 30 views
14

Tôi có virtualenv và virtualenvwrapper cài đặt, nhưng khi cố gắng cài đặt một ứng dụng, tôi nhập mkvirtualenv --no-site-packages tôi nhận được lỗi sau:mkvirtualenv --no-site-gói lệnh nhận được "không tìm thấy lệnh" lỗi

-bash: mkvirtualenv: command not found

Tôi không chắc chắn cách khắc phục sự cố này. Là một người mới bắt đầu, tôi sẽ rất biết ơn vì sự giúp đỡ nào.

Trả lời

26

Bạn cần bật virtualenvwrapper như được mô tả trong 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

Điều này thực sự có thể thay đổi một chút tùy thuộc vào cách bạn cài đặt nó. Nếu bạn đã cài đặt nó trên Ubuntu với apt, các hàm virtualenvwrapper thực sự được cuộn vào một tệp hoàn thành bash (tìm ra điều đó thật thú vị!).

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 
Các vấn đề liên quan