vscode 代码无法转定义

方法1:
试着装其他版本的python或者pylance,有时候好使有时候不好使

方法2:

在当前目录下的.vscode文件夹下新建settings.json文件,在里面新增:

{"python.jediEnabled": false
}

关掉vscode项目再重打开,就可以了

方法3:
https://zhuanlan.zhihu.com/p/344118024
链接还介绍了Pylance

打开settings.json设置文件,打开方法为在VS Code中键入ctrl+shift+P全局快捷键,打开命令搜索窗,输入settings.json​即可打开首选项。
打开发现该设置文件中并无此项(推断可能是设置为None),所以直接导致无法实现"转到定义"​功能​。于是,在json文件中手动加入上述配置代码​:
"python.languageServer": "Jedi"

{
    "python.pythonPath": "/anconda_install/envs/pytorch1.7/bin/python",
    "python.languageServer": "Jedi"
}
posted @ 2023-12-29 10:35  无左无右  阅读(273)  评论(0编辑  收藏  举报