亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

PyCharm如何配置SSH和SFTP連接遠(yuǎn)程服務(wù)器

 更新時(shí)間:2022年05月10日 14:58:15   作者:XerCis  
這篇文章主要介紹了PyCharm如何配置SSH和SFTP連接遠(yuǎn)程服務(wù)器,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

簡(jiǎn)介

  • SSH,Secure Shell,安全外殼協(xié)議,用于遠(yuǎn)程登錄會(huì)話
  • SFTP,Secret File Transfer Protocol,安全文件傳送協(xié)議,用于同步文件

Windows 連接遠(yuǎn)程服務(wù)器進(jìn)行 Linux 環(huán)境下的 Python 開發(fā)需要結(jié)合 SSH 和SFTP

安裝

安裝 PyCharm Professional

PyCharm Community 沒(méi)有該選項(xiàng),無(wú)法配置 SSH Interpreter

登陸遠(yuǎn)程服務(wù)器

ssh user@host [-p port]

查看是否開啟 SSH 服務(wù)

service sshd status

如果顯示 Loaded: not-found (Reason: No such file or directory) 或 sshd: unrecognized service,則需要安裝

sudo apt-get install openssh-server

如果顯示 Active: inactive (dead),則需要啟動(dòng)

sudo /etc/init.d/ssh restart

只要 SSHD 服務(wù)啟動(dòng)了,SFTP便可使用

Tools → Deployment → Configuration…

+ → SFTP → New server name 隨意填(如 user@host:port) → 取消勾選 Visible only for this project → SSH configuration → + → 根據(jù) SSH 信息對(duì)應(yīng)填上 → Test Connection

SFTP 這里 Test Connection → Autodetect

File → Settings → Project: xxx → Python Interpreter → 設(shè)置 → Add… → SSH Interpreter → Existing server configuration

配置 Python 解釋器和同步文件夾,是否用 sudo 權(quán)限看情況勾選

初試

main.py

print(__file__)

可能需要手動(dòng)同步:Tools → Deployment → Upload to…

快捷鍵:Ctrl + Alt + Shift + X

遇到的坑

1. EOF while reading packet

需要啟動(dòng) SSHD 服務(wù)

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 報(bào)錯(cuò) “/etc/hosts” E166: Can’t open linked file for writing

查看真實(shí)路徑

readlink /etc/hosts

或者把文件刪了

4. Can’t get remote credentials for deployment server xxx@xxx:xx password

沒(méi)填 sudo 的密碼,可以重新配,直接 SSH Interpreter → New server configuration

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論