Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virtualenv: workon command not found

I have installed virtualenv and the virtualwrapper via apt-get, I got to a point where I created a virtual enviroment but however later on during that same day when I used the workon command it was not found. I further on went and inspected my home directory and .virtualenvs dir and the virtualenv I created earlier were still there ...any help would be appreciated. Thanks in advance.

like image 204
user2522955 Avatar asked Feb 21 '14 07:02

user2522955


People also ask

What is Workon command?

Use the workon createdenv command to subsequently activate a virtual environment or just run workon to list all available virtual environments created. You can navigate to other created virtual environments while on a given environment without necessarily deactivating it first. workon createdenv.

What is Workon virtualenv?

virtualenvwrapper is a set of extensions to Ian Bicking's virtualenv tool. The extensions include wrappers for creating and deleting virtual environments and otherwise managing your development workflow, making it easier to work on more than one project at a time without introducing conflicts in their dependencies.

Why pip install virtualenv not working?

Confirm you're in the virtual environment by checking the location of your Python interpreter, it should point to the env directory. As long as your virtual environment is activated pip will install packages into that specific environment and you'll be able to import and use packages in your Python application.

Where virtualenv is installed?

If you try to run virtualenv and find it isn't present, you can install it using pip. virtualenv.exe will likely now be found in your python installation directory under the Scripts subdirectory.


2 Answers

Solving this problem took two steps:

Add this to your .bashrc / .bash_profile / .zshrc:

# load virtualenvwrapper for python (after custom PATHs) venvwrap="virtualenvwrapper.sh" /usr/bin/which -s $venvwrap if [ $? -eq 0 ]; then     venvwrap=`/usr/bin/which $venvwrap`     source $venvwrap fi 

Then use:

source .bash_profile # or .bashrc / .zshrc 

to reflect the changes.

Additionally, if the terminal still sometimes cant find workon, use source .bash_profile to reset and find it again.

like image 50
agconti Avatar answered Sep 21 '22 10:09

agconti


type source .profile in home directory from terminal.

like image 24
achabacha322 Avatar answered Sep 21 '22 10:09

achabacha322