在vscode里面使用python环境 需要两步即可
在项目目录下创建虚拟环境
python -m venv .venv通过面板搜索全局的虚拟环境
在VSCode中,按下Ctrl+Shift+P(macOS是Cmd+Shift+P) 打开命令面板。Python: Select Interpreter
VSCode会自动检测到你项目中的.venv环境。如果看到了,直接点击选择即可。
如果没有自动检测到,你可能需要选择 “Enter interpreter path...“ 或 “Find...“,然后手动导航到.venv文件夹下的Python可执行文件。
Windows: ..venv\Scripts\python.exe
macOS/Linux: ./.venv/bin/python
作者:admin 创建时间:2025-10-20 17:55
最后编辑:admin 更新时间:2025-10-20 17:55
最后编辑:admin 更新时间:2025-10-20 17:55