简体   繁体   English

升级pycharm venv python版本

[英]Upgrading pycharm venv python version

I have python 3.6 in my venv on PyCharm.我在 PyCharm 的 venv 中有 python 3.6。 However, I want to change that to Python 3.8.但是,我想将其更改为 Python 3.8。 I have already installed 3.8, so how do I change my venv python version?我已经安装了 3.8,那么如何更改我的 venv python 版本?

I am on windows 10.我在 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.更改项目解释器设置的版本似乎是使用新的 venv 而不是我现有的 venv 以及我已安装的所有软件包运行。 Attempting to add a new intepreter also results in the "OK" button being greyed out, possibly due to the current venv being not empty.尝试添加新的解释器也会导致“确定”按钮变灰,可能是由于当前的 venv 不为空。

You need to create a new virtual environment with the interpreter which version is 3.8.您需要使用版本为 3.8 的解释器创建一个新的虚拟环境。

  1. Go to Settings => Project => Python Interpreter Go 到设置 => 项目 => Python 解释器

在此处输入图像描述

  1. Click on the vertical 3 dots, and click on "Add".单击垂直的 3 个点,然后单击“添加”。

在此处输入图像描述

  1. Select Virtualenv Environment => New Environment Select Virtualenv 环境 => 新环境

在此处输入图像描述

  1. Choose as base interpreter the one which version is 3.8 (the one you just installed)选择版本为 3.8(您刚刚安装的那个)作为基本解释器

在此处输入图像描述

  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)一旦你设置了新的解释器,PyCharm 会警告你,你需要根据你的requirements.txt文件更新一些依赖关系,在这种情况下, Pipfile.lock (我在这个项目中使用pipenv

在此处输入图像描述

That's it!而已!

In pycharm you can do further steps:在 pycharm 中,您可以执行进一步的步骤:

  1. Go in File-->Settings-->Python Interpreter Go 在文件-->设置-->Python解释器
  2. Select different python environment if already available from the drop down, If not click on "Add". Select 不同的 python 环境如果已经从下拉列表中可用,如果没有单击“添加”。
  3. Select New Environment option, then in Base interpreter you can select 3.8 version Select 新环境选项,然后在基本解释器中你可以 select 3.8 版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM