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?

  • How did you install Python 3.5.4 and where is it installed? Could you edit and add the output of type -a python3 python3.5? – wjandrea Jul 24 '19 at 17:06
  • I installed using $wget python.org/ftp/python/3.5.4/Python-3.5.4.tar.xz. When I do $which python3.5 it outputs usr/local/bin/python3.5. When I created the virtualenv the output was Running virtualenv with interpreter /usr/bin/python3.5 Using base prefix '/usr' New python executable in /home/aishwarya/rnn/venv/bin/python3.5 Also creating executable in /home/aishwarya/rnn/venv/bin/python Installing setuptools, pip, wheel... done. – Aishwarya Pothula Jul 24 '19 at 17:13
  • Ah ok, I don't think that's a recommended setup, but I also don't think it will cause any problems. In any case, please edit and add the output of type -a python3 python3.5. – wjandrea Jul 24 '19 at 17:20

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.

| improve this answer | |
  • 1
    thank you. I did just that. Works fine – Aishwarya Pothula Jul 24 '19 at 17:29

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

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.