在树莓派4通过命令行安装 Visual Studio Code 如下:
但是运行特别缓慢,调试 Python 代码会持续卡住,CPU 长时间 100% 占用。
目前一个可用的办法就是在 Visual Studio Code 中禁用 GPU 加速。
具体操作如下:
-
Open Visual Studio Code
-
Open the Command Palette by hitting your F1 key or the key combo Ctrl+Shift+P,或者菜单中选择 “命令面板” 如下图:
- Begin typing runtime and you should see “Preferences: Configure Runtime Arguments” appear (Pictured below). Click it or hit Enter to open a configuration file called argv.json which allows us to set runtime arguments.
- There should be the line
"disable-hardware-acceleration": true,
commented out. (Pictured below)
- Uncomment the line by deleting the preceding
//
or add the line if it is missing entirely.
Tip: Be careful not forget the comma if the line is not the last uncommented one inside the curly braces.
- Save the file and restart Visual Studio Code for the change to take effect.