3

I have python3.10 installed but I cannot set it as an interpreter.

The installation can be confirmed by calling python3.10 directly on the terminal, and with the command below:

$ ls -ls /usr/bin/python*
   0 lrwxrwxrwx 1 root root       9 Apr 16  2018 /usr/bin/python -> python2.7
   0 lrwxrwxrwx 1 root root       9 Apr 16  2018 /usr/bin/python2 -> python2.7
3548 -rwxr-xr-x 1 root root 3633000 Feb 27  2021 /usr/bin/python2.7
   0 lrwxrwxrwx 1 root root       9 Nov 17 05:41 /usr/bin/python3 -> python3.6
5312 -rwxr-xr-x 1 root root 5437464 Oct  5 07:05 /usr/bin/python3.10
4424 -rwxr-xr-x 1 root root 4526456 Jan 26  2021 /usr/bin/python3.6
4424 -rwxr-xr-x 1 root root 4526456 Jan 26  2021 /usr/bin/python3.6m
   0 lrwxrwxrwx 1 root root      10 Nov 17 05:41 /usr/bin/python3m -> python3.6m

However, when trying to configure python3.10 as the venv on Pycharm using the path above, I get Failed to create virtual environment. I think it has something to do with the arrows in the terminal print out above, so if anyone could help explain and configure it properly, it would be really helpful.

Caldazar
  • 2,801
  • 13
  • 21
weasel
  • 534
  • 1
  • 5
  • 18
  • This is for windows: You can try re-running the `setup` file for `python 3.10`, and during setup, check the box `"Add to path"`, now in pycharm "Add interpreter": select the location of `python.exe` from latest installation path. That worked for me. On linux, sorry dude i cannot help – Ishan Jindal Nov 19 '21 at 16:03
  • A note for the arrows - those are perfectly normal! You can see that the files with arrows have an "l" character in the second column. These are links (aka shortcuts for windows users). Python installs often create links so that calling `python` on the terminal will call the latest python2 version you have installed (2.7), and `python3` the latest python3 you installed (3.6). It seems you did something on the 17th November after installing 3.10 on the 5th October which reset `python3` to point to 3.6 instead of 3.10. But this won't affect pycharm, see answer below for that. – SamBob Nov 22 '21 at 10:40
  • 1
    @SamBob Thanks, realised they were symlinks halfway through, but that did not resolve the issue. – weasel Nov 22 '21 at 12:10
  • 1
    And to whoever marked this question as a duplicate, I really could not find the required solution there, so any way to unmark it? – weasel Nov 22 '21 at 12:11
  • 2
    This is not a duplicate. This is specific to needing to add venv for the new version of python. – toonarmycaptain Nov 23 '21 at 03:26

1 Answers1

5

Need to install the venv lib for each version of python.

In this case,

sudo apt-get install python3.10-venv

weasel
  • 534
  • 1
  • 5
  • 18