pycharm调试服务器代码
首先将要跑的代码放在服务器中,这里我放在:/home/chenhongming/
winscp上显示如下:
其中Chinese_poetry是我要跑的代码,然后本地要有对应的镜像文件,这里放桌面上了:C:\Users\Administrator\Desktop\Chinese_PoetryGen.pytorch-master
然后设置pycharm,Tools->Deployment->Configuration:点加号创建:name随便,type为SFTP
host填服务器IP,Root Path填根目录,可以自动填写,然后填username,password
然后进入Mappings,local path填本地镜像文件位置,服务器上就填根目录下位置。点击ok
然后选择服务器上的程序运行环境:file-settings-project interpreter点击设置符号,悬着add remote进入
内容填写如上,注意interpreter路径填服务器上python路径。
最后在pycharm右上角选择edit configurations进去设置interpreter为add remote中导入的服务器上的interpreter
然后就可以在本地运行调试代码了。