6

I have python 3.6 in my venv on PyCharm. However, I want to change that to Python 3.8. I have already installed 3.8, so how do I change my venv python version?

I am on windows 10.

Changing the version on the project intepreter settings seems to run using the new venv not my existing venv with all the packages I have installed. Attempting to add a new intepreter also results in the "OK" button being greyed out, possibly due to the current venv being not empty.

lmiguelvargasf
  • 63,191
  • 45
  • 217
  • 228
weasel
  • 534
  • 1
  • 5
  • 18

2 Answers2

5

You need to create a new virtual environment with the interpreter which version is 3.8.

  1. Go to Settings => Project => Python Interpreter

enter image description here

  1. Click on the vertical 3 dots, and click on "Add".

enter image description here

  1. Select Virtualenv Environment => New Environment

enter image description here

  1. Choose as base interpreter the one which version is 3.8 (the one you just installed)

enter image description here

  1. Click on "OK" => "OK"

  2. Once you have set the new interpreter, PyCharm will warn you that you need update some dependencies based on your requirements.txt file or, in this case, Pipfile.lock (I am using pipenv for this project)

enter image description here

That's it!

lmiguelvargasf
  • 63,191
  • 45
  • 217
  • 228
  • 2
    Kind of a dumb question, but Pycharm says I need an empty environnement location. I can do that just fine, but I want to overwrite my old python version for the current environnement location with the newest version, can this be done? I want to do this because I have my own scripts in the old environnement location and having to create a new location would mean that I would need to copy paste my scripts from the old location to the new one, which doesn't seem right. Any thoughts on this? Thank you. – MorningGlory Jan 21 '21 at 14:46
  • @MorningGlory did you manage to sort this out? – Javi Torre Feb 02 '23 at 07:29
1

In pycharm you can do further steps:

  1. Go in File-->Settings-->Python Interpreter
  2. Select different python environment if already available from the drop down, If not click on "Add".
  3. Select New Environment option, then in Base interpreter you can select 3.8 version
Ruta Deshpande
  • 170
  • 1
  • 10