網(wǎng)站首頁 編程語言 正文
簡介
-
SSH
,Secure Shell,安全外殼協(xié)議,用于遠程登錄會話 -
SFTP
,Secret File Transfer Protocol,安全文件傳送協(xié)議,用于同步文件
Windows 連接遠程服務器進行 Linux 環(huán)境下的 Python 開發(fā)需要結合 SSH 和SFTP
安裝
安裝 PyCharm Professional
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 → + → 根據(jù) 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
原文鏈接:https://xercis.blog.csdn.net/article/details/122682487
相關推薦
- 2022-06-02 C語言?隊列的實現(xiàn)全解析_C 語言
- 2022-05-29 Python實現(xiàn)灰色關聯(lián)分析與結果可視化的詳細代碼_python
- 2022-02-01 Google Chrome進入暗黑模式
- 2022-10-11 Linux下恢復應用程序被刪除的文件(lsof)
- 2023-06-13 C++?ncnn模型驗證精度實現(xiàn)代碼_C 語言
- 2022-02-27 一個多模塊的Spring Boot項目打成多個jar包在服務器上運行
- 2022-12-04 python?使用enumerate()函數(shù)詳解_python
- 2023-10-16 element--el-input限制輸入為數(shù)字且必須大于0
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細win安裝深度學習環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結構-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支