简体   繁体   English

Visual Studio代码Django Python调试器指向较旧的virtualenv

[英]Visual Studio code Django Python debugger points to an older virtualenv

I was having some issues with my .virtualenv folders (had 2 projects working in parallel, and one virtual environment was looking at the other), so I manually deleted them and re-did a pipenv/pip install of just 1 project. 我的.virtualenv文件夹有一些问题(有2个项目并行运行,而一个虚拟环境正在查看另一个虚拟环境),所以我手动删除了它们并重新安装了仅1个项目的pipenv / pip安装。 I verified that the new folders for the same project got created. 我验证了是否为同一项目创建了新文件夹。 However, when I try to debug the project using Visual Studio Code, it gives me this error: 但是,当我尝试使用Visual Studio Code调试项目时,它给了我这个错误:

& : The term 'C:\Users\userId\.virtualenvs\project-1abcde2S\Scripts\python.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.

Where the project-1abcde2S points to the folders I deleted. project-1abcde2S指向我删除的文件夹的位置。 Is there anyway to ensure that new virtual environments get picked up in Visual Studio code? 无论如何,要确保在Visual Studio代码中获取新的虚拟环境? any other tips on debugging a Django project would be helpful! 其他有关调试Django项目的提示将很有帮助!

When you first select an environment for a workspace it gets written to your .vscode/settings.json configuration file. 当您第一次为工作区选择环境时,它会被写入您的.vscode/settings.json配置文件。 It sounds like you just need to update that setting by selecting your new environment . 听起来您只需要通过选择新环境来更新该设置即可。

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

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