python - 通过 SSH 为远程 Python 解释器配置 Visual Studio Code
问题描述
我有一个带有 ArchLinux 和 Python 的 Vagrant 盒子,每个项目使用一个虚拟环境(通过使用某个 Python 版本)。我希望配置 VSC 以运行/调试这些 Python 项目。我已经安装了包含我的项目的目录(使用sshfs)所以我不必担心同步。
使用 PyCharm,配置仅在其 IDE 中。如何使用 SSH 为 VSC 配置它?使用 Python 还需要哪些其他插件?
提前致谢。
PS1:PyCharm 是一个很棒的工具,但它需要很多资源,接近 1GB 的 RAM。
PS2:我读过这篇文章,但我不清楚,一个例子更有用。
解决方案
使用 Pydev 和 RSE 服务器在远程 Linux 机器上定义远程解释器的帖子非常有用,现在看起来很明显。这是我使用自己的系统配置的解决方法:
第 1 步:挂载您的远程主文件夹。
$ sshfs -o password_stdin,transform_symlinks vagrant@localhost:/home/vagrant ~/Vagrant/archi02/Remote/ -p 2222 <<< "your_vagrant_password"
第 2 步:使用 VSC 打开您的项目文件夹。
~/Vagrant/archi02/Remote/Projects/Python_3_7_2/QuickPythonBook/
第 3 步:为您的远程 Python 和 linter配置“ settings.json ”(来自WorkSpace Settings )。
{
"python.pythonPath": "~/Vagrant/archi02/Remote/Projects/Python_3_7_2/QuickPythonBook/ve_qpb/bin/python3.7",
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "pylint"
}
第 4 步:享受编程。不客气。
推荐阅读
- amazon-web-services - 我们可以限制从 AWS Cloud9 IDE 下载源代码吗?
- python - 使用 Python 在 Pandas + Matplotlib + Seaborn 中连续绘制热图或剖面图
- sql - Powershell脚本通过电子邮件中附加的表格格式的Sql查询获取输出?
- python - Python Regex 提取句子中的某些单词
- python - Flask 多次运行相同的请求
- rest - 如何保护可公开访问的 API?
- java - 有没有办法在 apache flink 中定义 jar 启动参数
- c++ - valgrind 报告的 SDL2 linux 内存泄漏
- wordpress - Wordpress - 插件 H5P - 单击获取安装活动时出现错误 403,我收到 403 错误消息
- javascript - 谁能帮我解决这个 React Native 问题?