Locked learning resources

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

Unlock This Lesson

Locked learning resources

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

Unlock This Lesson

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.

Avatar image for hirejorge

hirejorge on March 6, 2020

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

Avatar image for Dan Bader

Dan Bader RP Team on March 7, 2020

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

C:\> where pip
Avatar image for Martie

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:


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.

Avatar image for markmatthewsdeveloper

markmatthewsdeveloper on July 22, 2022

If your on Windows to activate your environment use this:


Avatar image for Martin Breuss

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.