# 下载并安装VS Code
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update
sudo apt install code
{
"editor.fontSize": 14,
"editor.tabSize": 4,
"editor.wordWrap": "on",
"files.autoSave": "afterDelay",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.provider": "black",
"jupyter.askForKernelRestart": false,
"terminal.integrated.fontSize": 13,
"workbench.colorTheme": "Default Dark+",
"workbench.iconTheme": "material-icon-theme"
}
# 安装Python虚拟环境工具
sudo apt install python3-venv
python3 -m venv ~/.venvs/interactive-dev
source ~/.venvs/interactive-dev/bin/activate
pip install ipykernel jupyterlab numpy pandas matplotlib
# %%
标记创建代码单元格Ctrl+Enter
执行当前单元格{
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.shell.linux": "/bin/bash",
"terminal.integrated.env.linux": {
"PYTHONPATH": "${workspaceFolder}"
}
}
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Jupyter: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true,
"jupyter": true
}
]
}
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/__pycache__": true,
"**/*.pyc": true
}
code --max-memory=8192
~/.ssh/config
简化连接Host dev-server
HostName your.server.ip
User yourusername
IdentityFile ~/.ssh/id_rsa
{
"docker.containers.description": "Interactive Development",
"docker.commands.attach": "/bin/bash",
"docker.explorer.refreshInterval": 3000
}
创建语言特定片段(File > Preferences > Configure User Snippets
)
{
"Interactive Plot": {
"prefix": "plt",
"body": [
"import matplotlib.pyplot as plt",
"%matplotlib inline",
"",
"plt.figure(figsize=(10,6))",
"plt.plot(${1:x}, ${2:y})",
"plt.title('${3:Title}')",
"plt.xlabel('${4:X Label}')",
"plt.ylabel('${5:Y Label}')",
"plt.show()"
],
"description": "Create interactive matplotlib plot"
}
}
Jupyter内核无法启动:
jupyter --version
pip install --upgrade ipykernel
扩展冲突:
性能问题:
Help > Open Process Explorer
)终端问题:
$PATH
设置正确通过以上配置,您可以在Linux上获得一个强大的人机交互开发环境,特别适合数据科学、机器学习原型设计和交互式应用开发。