我的 Python 都是基于虚拟环境的,在使用vscode 进行代码调试的时候,非常不方便,为什么呢,因为找不到模块,后面试了几次
我们长话短说
问题一, 明明安装了 这个模块,但是在vscode 还是生成感叹号
处理办法
这个地方切换到你安装这个包的环境,因为我这里一直是在虚拟环境开发,所以,你懂的
问题2 调试进不了断点
vscode 创建 一个配置json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: 当前文件",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
可以了
主要问题点
1个就是, 你安装的包在哪
2个就是, 需要打断点调试,建议配置一个json