Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
466 views
in Technique[技术] by (71.8m points)

python 3.x - Virtualenv - workon command not found

I followed these steps to set up virtualenv + virtualenvwrapper:

$ sudo apt-get install python3-pip

$ sudo pip3 install virtualenv
$ sudo pip3 install virtualenvwrapper

$ mkdir ~/.virtualenvs

$ export WORKON_HOME=~/.virtualenvs

$ VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3'

$ source /usr/local/bin/virtualenvwrapper.sh

$ mkvirtualenv venv
$ virtualenv venv

So far it was working fine but I restarted the shell and then I tried workon venv and now it says: command not found

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

So far it was working fine but I restarted the shell

The reason is because you restarted the shell.

If you want this to work with each shell, you'll need to add these to your ~/.bashrc file:

export WORKON_HOME=~/.virtualenvs
VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3'
source /usr/local/bin/virtualenvwrapper.sh

After adding this, you'll want to source ~/.bashrc so the changes take effect. You'll find that you have access to virtualenvwrapper facilities in each new shell.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...