Can I add python3.9 as an interpreter in PyCharm 2024.1.4 (Community Edition)

The version of pycharm I am using is PyCharm 2024.1.4 (Community Edition)

Build #PC-241.18034.82, built on June 25, 2024

Runtime version: 17.0.11+1-b1207.24 amd64

Because of the application requirements, my python can only use this specific version 3.9.1.

My problem is that after installing pycharm, I tried to add the interpreter, and when I set the system default interpreter, it succeeded.

Python 3.9 (pythonProject)

When I selected the virtual environment interpreter in the original project folder, it failed,

I am using python3.9, but it always adds 3.13 in front, like this

Python 3.13(my project)

I even changed its name by editing,

Python 3.9(my project)

 

 but it cannot be saved, what should I do?

I confirmed that there is no 3.13 version of Python on my PC, only one 3.9

0
Hi,
Sure, let us check what's going on here; please, can you tell us what OS you are using and how Python was installed?
0

Thank you very much for your attention.

I found the reason yesterday.
My OS is win11. I just changed to a new computer, installed pycharm and python 3.9.1, and then copied all the python project folders from the old computer.

After opening the existing project, I need to specify the interpreter. When I select the original virtual environment under the project folder, it cannot be specified, and always shows  in front, like this

Python 3.13(my project), but I only have python 3.9

I found a way to import the previous venv interpreter. Because the username of my new and old computers is different, I can't import it directly, but need to modify the path in pyvenv.cfg, so it succeeds.

But my previous description still has no answer, why it shows Python 3.13, but it seems to be unimportant. If the developer is interested, maybe he can see if it is a bug.

0
The issue is not reproducible for me with Python 3.9.1, Windows 11, and a newly created virtual environment. 
Was the virtual environment copied with the project? If yes, then it's not going to work: venvs are not really portable, and it is easier to re-create venv in most cases. Even if you modify pyvenv.cfg, there are still old paths in symlinks.
Here is a good SO thread on moving virtual envs: https://stackoverflow.com/a/58772116
0

请先登录再写评论。