Virtualenv Python version

I have Python3.5.2 by default on my Ubuntu System. I recently installed Python3.5.4. When I run python3 --version it outputs 3.5.2 and when I run python3.5 it shows 3.5.4.

I want my project to use Python3.5.4 so I created a virtualenv inside my project using virtualenv -p /usr/bin/python3.5 venv

What command can I use to verify that my project directory is using Python3.5.4?

3

2 Answers

Your virtualenv's python binary is symlinked at venv/bin/python, so simply run

venv/bin/python --version

However, if python3 is 3.5.2, /usr/bin/python3.5 should be 3.5.2, so I don't think you'll get the result you want (3.5.4). You'll probably need to rebuild the virtualenv with /usr/local/bin/python3.5 as the interpreter.

1

I found the answer. My Python3.5.4 got installed in usr/local/bin. So I should have created a virtualenv with this path. $virtualenv -p /usr/local/bin/python3.5.

To check what version my project is using I activated venv using $source ven/bin/activate and then typed in $python. It gives the following output. It is using Python3.5.4

Python 3.5.4 (default, Jul 24 2019, 10:56:54) [GCC 5.4.0 20160609] on linux

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like