为了在远程机器上调试修改后的代码,需要准备远程开发环境。
查看当前机器是否安装Python解释器:python --version
安装Python解释器。
参考:https://code.visualstudio.com/docs/remote/ssh
To install the OpenSSH components on Windows 11 devices:
-
Open Settings, select System, then select Optional Features.
-
Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, select View Features, then:
- Search for OpenSSH Client, select Next, then select Install
- Search for OpenSSH Server, select Next, then select Install
-
Open the Services desktop app. (Select Start, type services.msc in the search box, and then select the Service app or press ENTER.)
-
In the details pane, double-click OpenSSH SSH Server.
-
On the General tab, from the Startup type drop-down menu, select Automatic and then select Ok.
-
To start the service, select Start.
如果发现ssh无法连接,请为Windows账号设置一个密码,并且防火墙的Inbound Rules的Profile设置为All。
更改pip下载源并安装uiautomation库:
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip install uiautomation
生成一对key pair,把公钥内容放入一个名为administrators_authorized_keys的文件里,把这个文件放到C:\ProgramData\ssh\下,注意这个目录是隐藏的。参考:Key-based authentication in OpenSSH for Windows | Microsoft Learn