目录简介安装初试遇到的坑简介 ssh,Secure shell,安全外壳协议,用于远程登录会话SFTP,Secret File Transfer Protocol,安全文件传送协议,
windows 连接远程服务器进行 linux 环境下的 python 开发需要结合 SSH 和SFTP
PyCharm CommUnity 没有该选项,无法配置 SSH Interpreter
登陆远程服务器
ssh user@host [-p port]
查看是否开启 SSH 服务
service sshd status
如果显示 Loaded: not-found (Reason: No such file or directory) 或 sshd: unrecognized service,则需要安装
sudo apt-get install openssh-server
如果显示 Active: inactive (dead),则需要启动
sudo /etc/init.d/ssh restart
只要 SSHD 服务启动了,SFTP便可使用
Tools → Deployment → Configuration…
+ → SFTP → New server name 随意填(如 user@host:port) → 取消勾选 Visible only for this project → SSH configuration → + → 根据 SSH 信息对应填上 → Test Connection
SFTP 这里 Test Connection → Autodetect
File → Settings → Project: xxx → Python Interpreter → 设置 → Add… → SSH Interpreter → Existing server configuration
配置 Python 解释器和同步文件夹,是否用 sudo 权限看情况勾选
main.py
print(__file__)
可能需要手动同步:Tools → Deployment → Upload to…
快捷键:Ctrl + Alt + Shift + X
1. EOF while reading packet
需要启动 SSHD 服务
2. sudo: unable to resolve host xxx: No such file or directory
sudo vim /etc/hosts
添加
127.0.0.1 localhost xxx
3. vim /etc/hosts 报错 “/etc/hosts” E166: Can’t open linked file for writing
查看真实路径
readlink /etc/hosts
或者把文件删了
4. Can’t get remote credentials for deployment server xxx@xxx:xx passWord
没填 sudo 的密码,可以重新配,直接 SSH Interpreter → New server configuration
以上为个人经验,希望能给大家一个参考,也希望大家多多支持编程网。
--结束END--
本文标题: PyCharm如何配置SSH和SFTP连接远程服务器
本文链接: https://www.lsjlt.com/news/117873.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-04-18
2024-04-17
2024-04-11
2024-04-08
2024-04-08
2024-04-03
2024-03-15
2024-03-15
2024-03-11
2024-03-08
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0