Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Activating a Virtual Environment in the Terminal

In this lesson, you’ll learn how to activate a virtual environment using the activate script. The lesson also covers one way to check which third party libraries are installed in the virtual environment.

hirejorge on March 6, 2020

which pip3 command does not work inside of windows vscode. what would be the equivalent in windows?

Dan Bader RP Team on March 7, 2020

On Windows, you can use the where.exe command. This should work:

C:\> where pip

Martie on May 15, 2020

As I’m watching this course I’m struggling with a real venv issue.

I’m trying to set up a python 3.7.3 virtual environment on a web host. I’ve got a subdomain portfolio.pym-ltd.com which I have all my scripts in and I need it to have Python 3.7.3 running.

In the terminal I can do this:

[pymlrfvr@server254 portfolio.pym-ltd.com]$
[pymlrfvr@server254 portfolio.pym-ltd.com]$ python -V
Python 2.6.6
[pymlrfvr@server254 portfolio.pym-ltd.com]$ source /home/pymlrfvr/virtualenv/portfolio.pym-ltd.com/3.7/bin/activate && cd /home/pymlrfvr/portfolio.pym-ltd.com
(portfolio.pym-ltd.com:3.7)[pymlrfvr@server254 portfolio.pym-ltd.com]$ python -V
Python 3.7.3
(portfolio.pym-ltd.com:3.7)[pymlrfvr@server254 portfolio.pym-ltd.com]$

which I thought means I’m running Python 3.7.3 in the subdomain space, BUT when I run a small python script to show the sys.version_info I get:

www.portfolio.pym-ltd.com/ignore%20index.php

This is Python! Honestly! (2, 6, 6, 'final', 0)

Have you any idea why the terminal shows Python 3.7.3, but the code running in the browser identifies 2.6.6.

I can only think I’ve missed something really simple.

markmatthewsdeveloper on July 22, 2022

If your on Windows to activate your environment use this:

.\venv\Scripts\activate

Martin Breuss RP Team on July 25, 2022

Thanks @markmatthewsdeveloper! If someone watching this is on Windows, also check out the associated tutorial that goes into more detail and has all the Windows commands and file structures as well.

@Martie just seeing your comment here so this reply is probably too late for you, but maybe someone else might run into a similar issue. Probably what happened here is that you’re running the script without using the absolute path to your Python executable inside your venv. Check out the linked section for more info. :)

Become a Member to join the conversation.