A few months ago I installed virtualenv, virtualenvwrapper and pip, created a few virtual environments and played with Django successfully.
After returning to my projects today, I am unable to use any of these commands. For instance:
/> lsvirtualenv
returns:
/ >
Further:
/ > workon
also returns:
/ >
What might be the reason for this? Folder .virtualenv is located here /users/myUser/documents/projects/.virtualenvs and its contents are:
get_env_details
postactivate
postmkproject
postrmvirtualenv
predeactivate
premkvirtualenv
initialize
postdeactivate
postmkvirtualenv
preactivate
premkproject
prermvirtualenv
What am I missing? Thanks!
These commands are generated by the script
virtualenvwrapper.sh. You have to source that file in order to get the commands.Try this:
It should find and return the filepath. On my system it is:
So you can do:
Now you should have the commands. Probably you'd like to have these commands without sourcing
virtualenvwrapper.sheverytime you boot your system.Add that line to your
.bashrc(or alternatively in.bash_profileor.profile), along with two other linesAfter that create the directory
Projects(you can call it whatever you want and place it whereever you want) manually:After the next start you should have all the commands and the new environment variables. When you do:
new directory foo will be created:
and:
The first one is your virtual environment, the second one is where your projects lives. With
workon fooyou can activate it, and withcdvirtualenvandcdprojectyou can switch between them.EDIT:
After rereading your question, I think the problem might be eventually with the way how you created the virtual environments.
The commands
lsvirtualenvandworkonare provided byvirtualenvwrapper. If you create your virtual environments with the comandmkvirtualenv(also provided byvirtualenvwrapper) thenlsvirtualenvandworkonwill list them.But if you create them like this:
virtualenvwrapperwon't be aware of your virtual environments.