问题:vscode不加载python,导致无法使用pep8和无法调试
解决:
方法1:简单
1.卸载服务器端python和pyplace扩展
2.关闭服务器的vscode服务
按F1,kill vscode server
3.连接服务器,重新安装扩展。
如果不行:
去项目下删除.vscode目录,并删除所有扩展,再关闭vs server,再重新安装扩展。
建议安装的python扩展:
4. 重启代码解析服务器
方法2: 修改配置文件
代码加载慢,很久才出提示,或者不出提示:
添加:
这俩个都可以
files.watcherExclude
python.analysis.exclude
// 不解析某些文件夹
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true,
"**/.hg/store/**": true,
"**/logs": true,
"**/collect_car/**": true,
"**/output2/**": true,
"**/outputs/**": true,
"**/onnx/**": true,
"**/test/**": true,
"**/test_out/**": true,
"**/大货车/**": true,
"**/log/**": true,
"**/huawei/**": true,
"**/frames/**": true,
"**/images/**": true,
"**/merged/**": true,
"**/**.mdb": true,
"**/*.mdb": true,
"**/**.jpg": true,
"**/*.jpg": true,
"**/**.bmodel": true,
"**/*.bmodel": true,
"**/**.mp4": true,
"**/*.mp4": true,
"**/**.txt": true,
"**/*.txt": true,
"**/**.log": true,
"**/*.log": true,
"**/**.out": true,
"**/*.out": true,
"**/**.pth": true,
"**/*.pth": true,
"**/**.pt": true,
"**/*.pt": true,
"**/*.onnx": true,
"**/**.onnx": true,
"**/**.png": true,
"**/*.png": true,
"**/__pycache__/**": true
},
"python.analysis.exclude": ["logs", "log", "huawei", "frames", "images", "merged", "test", "**/*.mdb", "**/*.jpg", "**/*.bmodel", "**/*.mp4", "**/*.txt", "**/*.log", "**/*.pth", "**/*.pt", "**/*.onnx", "**/*.png"],
如果还是不行,就修改一下vscode默认解析的文件个数:
先看一下默认的
cat /proc/sys/fs/inotify/max_user_watches
里面的内容应该是:8192
修改:
在这个 /etc/sysctl.conf 文件最下面添加一行:
fs.inotify.max_user_watches=524288
然后运行
sudo sysctl -p
524288是vscode默认解析的最大的文件个数