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 trialCharles Steinmetz
14,420 PointsVirtual Environment - Python
Hello,
I am trying to activate venv on a windows 7 computer. I am in command and entering the path correctly with activate. I am getting an error that \Python34\Lib\env\scripts\activate is not recognized as an internal or external command.
Does anyone know the correct way to activate venv?
Thank you!
1 Answer
Chris Freeman
Treehouse Moderator 68,457 PointsIf you have created a virtual environment using the command:
C:\Users\User>virtualenv venv
You can activate the virtual env using:
C:\Users\User>venv\Scripts\activate
(venv) C:\Users\User>
Deactivate using deactivate
Charles Steinmetz
14,420 PointsCharles Steinmetz
14,420 PointsI get an error running virtualenv. Its not recognized as an internal or external command or batchfile.
Not sure if I am missing dependencies?
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 PointsOn Windows, the virtualenv.exe is usually located in the python scripts directory: C:\Python34\Scripts\, C:\Python27\Scripts, etc depending on the installed version of python. This directory needs to be included in your PATH variable.
First, verify that python is on your path by typing "python" in a command prompt window.
Second, check to see if virtualenv was installed by looking for virtualenv.exe* in the python scripts directory If found, you can test it by giving the full path of the executable. The following command displays the script version number. (the .exe is optional)
C:\Python34\Scripts\virtualenv.exe --version
Next, check if the Scripts directory containing the virtualenv.exe script is on your windows path by typing "path" in a command prompt window.
If you need to change your path, look at the teacher's notes for the Using virtualenv video.