Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Setting Up a Local Python Environment Installing Python and Python Libraries Locally Using virtualenv

-bash: virtualenv: command not found Any ideas or explanations for this?

The Teacher's Notes claim that after setting the PATH in .bash_profile then one should be able to enter virtualenv from user folder command line and get a description of the virtualenv, and that said, should be able to create a new virtualenv from there with having to enter path/to/bin/virtualenv. However I am not getting these results and it's quite annoying. Is it just not possible? I did discover that the virtualenv must be activated 'from source' and not through 'bash' is this perhaps the case with virtualenv?

Here are contents of .bash_profile and $PATH and my terminal output.

.bash_profile:

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave

export PATH=β€œ~/Library/Python/3.4/bin:${PATH}”

$PATH

schleps-MacBook-Pro:~ schlep$ echo $PATH
β€œ~/Library/Python/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin”

and the terminal output :

schleps-MacBook-Pro:~ schlep$ virtualenv
-bash: virtualenv: command not found
schleps-MacBook-Pro:~ schlep$ 

Try these step:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python
pip install virtualenv
pip install virtualenvwrapper
nano ~/.profile

then paste the following:

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

To save and exit, hit Ctrl-X and then type 'Y' + Return.

Then run mkdir ~/.virtualenvs

close and then reopen terminal.

now you can do

mkvirtualenv env

(or whatever name you like) and it will be made and stored in the virtualenvs folder

to activate it you can use:

workon env

to exit from that env you can just type:

deactivate