简体   繁体   English

Pycharm使用错误的python版本运行虚拟环境

[英]Pycharm run the virtual environment with wrong python version

在此处输入图片说明

I moved to a new PC then cloned my project, already set interpreter but terminal keeps using an old version of Python which is the default on my Mac.我搬到了一台新电脑,然后克隆了我的项目,已经设置了解释器,但终端一直使用旧版本的 Python,这是我 Mac 上的默认设置。 How can I run newer (venv) Python version in the terminal?如何在终端中运行更新的(venv)Python 版本?

Update image: Using virtualenv in the terminal (not built-in by PyCharm)更新图像:在终端中使用 virtualenv(不是 PyCharm 内置的)

在此处输入图片说明

@vicktor9450 I will outline steps required to ensure that when you type python in your terminal it starts the shell with python3 @vicktor9450 我将概述所需的步骤,以确保当您在终端中键入python ,它会使用python3启动 shell

  • Creating virtual environment simplest format, virtualenv [name] --python=[python to use]创建虚拟环境最简单的格式, virtualenv [name] --python=[python 使用]
  • [ ] Create a virtual environment: virtualenv venv --python=python3 [ ] 创建虚拟环境: virtualenv venv --python=python3
  • [ ] Goto Pycharm > Preferences > Project > Project Interpreter [] 转到 Pycharm > 首选项 > 项目 > 项目解释器
  • [ ] On the far right of the Projet Interpreter dropdown click on the cog/gear icon [ ] 在Projet Interpreter下拉菜单的最右侧,单击齿轮/齿轮图标

在此处输入图片说明 - [ ] Click on the option add - [ ] 点击选项添加

在此处输入图片说明

  • [ ] Select existing environment option and select the virtual environment you just created, apply and save changes and that should be all [ ] 选择现有环境选项并选择您刚刚创建的虚拟环境,应用并保存更改,这应该是全部在此处输入图片说明

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

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