简体   繁体   English

VS Code:如何将 WSL2 终端设置为虚拟环境?

[英]VS Code: How to set WSL2 terminal to virtual environment?

I'm setting up a virtual environment for a project, which I did without much trouble using the command prompt terminal.我正在为一个项目设置一个虚拟环境,我使用命令提示符终端没有太多麻烦。 However, if I open a second terminal but this time with Ubuntu (WSL2), it doesn't even have the same Python version.但是,如果我打开第二个终端,但这次使用 Ubuntu (WSL2),它甚至没有相同的 Python 版本。 Probably it has to do with the virtualization of Ubuntu, but I'd like to know how can I have both terminals using the same virtual environment?可能与 Ubuntu 的虚拟化有关,但我想知道如何让两个终端使用相同的虚拟环境?

Pictures for reference:图片供参考:

在此处输入图像描述

在此处输入图像描述

I am afraid it's impossible.恐怕这是不可能的。

In the first picture, you had got into the Linux system, so you can not take advantage of the python environment which in the windows system.在第一张图片中,您已经进入了 Linux 系统,因此您无法利用 windows 系统中的 python 环境。

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

相关问题 (venv) 标识符未显示在 VS Code Insider 的集成终端(WSL2 Ubuntu)中,但显示在终端预览中 - (venv) identifier not showing in VS Code Insider's integrated terminal (WSL2 Ubuntu), but is showing in Terminal Preview 虚拟环境未显示在 VS Code 终端中 - Virtual Environment Not showing up in VS Code Terminal Python 尽管在 WSL2 中激活了虚拟环境,但版本没有改变 - Python versions are not changing despite activating virtual environment in WSL2 pipenv 在 vs 代码中设置虚拟环境的路径 - pipenv set path of virtual environment in vs code WSL2:Python 使用 VS 代码调试器重命名文件 - WSL2: Python rename files from with VS Code debugger 如何在 vs-code 中定义虚拟环境 - How to define a virtual environment in vs-code 选择正确的解释器时,VS Code 集成终端未启动虚拟环境 - VS Code integrated terminal not starting with virtual environment activated while the right interpreter is being selected 每当我在 vs code 中打开终端时,我的虚拟环境都会自动开始运行 - Whenever i open my terminal in vs code my virtual environment automatically starts to run Python 脚本在虚拟环境中从终端运行,但无法使用 VS Code 播放按钮找到 pandas - Python script runs from terminal in virtual environment, but fails to find pandas with VS Code play button 如何在 VS Code 中设置 python 环境变量? - How to set python environment variables in VS Code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM