写点什么

20250709: WSL+Pycharm 搭建 Python 开发环境

作者:codists
  • 2025-07-09
    广东
  • 本文字数:450 字

    阅读完需:约 1 分钟

一、说明

1.代码和解释器的位置

1.1 代码在 Windows,解释器在 WSL 。


1.2 代码 & 解释器都在 WSL。


注:1.无论哪个组合,打开 terminal 的时候都无法自动激活虚拟环境,需要手动激活。

2.流程概述

2.1 安装 WSL


限于篇幅,不做详细介绍,参考:https://learn.microsoft.com/zh-cn/windows/wsl/install


2.2 安装 Python


安装在 WSL 里面,使用以下命令进行安装:


sudo apt install python
复制代码


2.3 安装 Pycharm


安装在 windows。限于篇幅,不做详细介绍,参考:。


2.4 设置解释器


使用 WSL 里面的 Pyrthon。

二、“代码 & 解释器都在 WSL”搭建流程

1.点击 File > Open


2.选择位于 WSL 里面的项目


3.点击 Pycharm 右下角的 Python Interpreter selector,选择 On WSL...


4.点击 Next


5.创建解释器


6.打开 terminal, 手动激活虚拟环境


三、“代码在 Windows,解释器在 WSL”搭建流程

1.点击 File > Open


2.选择位于 WSL 里面的项目


3.点击 Pycharm 右下角的 Python Interpreter selector,选择 On WSL...


4.点击 Next


5.创建解释器


6.打开 terminal, 手动激活虚拟环境



欢迎搜索及关注:编程人(a_codists)

发布于: 刚刚阅读数: 2
用户头像

codists

关注

公众号:编程人 2021-01-14 加入

Life is short, You need Python

评论

发布
暂无评论
20250709: WSL+Pycharm 搭建 Python 开发环境_Python_codists_InfoQ写作社区