PyCharm远程调试

时间:2013-04-19 13:05:46

标签: python remote-debugging pycharm

我有远程Ubuntu服务器,我正在尝试设置远程调试。 配置如图here所示。

import sys
import pydevd
sys.path.append('/root/home/scripts/pycharm-debug.egg')
pydevd.settrace('my_remote_server_IP', port=51234,
stdoutToServer=True, stderrToServer=True)

我还连接远程主机,用于同步和上传我的python脚本到远程服务器。 (工具 - >部署 - > ...)

当我开始调试时:

C:\Python27\python.exe C:/Projects/python/demo.py
Could not connect to xx.xx.xx.166: 51234
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 2.7.1\helpers\pydev\pydevd_comm.py", line 428, in StartClient
    s.connect((host, port))
  File "C:\Python27\Lib\socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 10061] ����������� �� �����������,

Process finished with exit code 1

如何解决这个问题?

2 个答案:

答案 0 :(得分:7)

pydevd.settrace函数的第一个参数应该是主机,其中安装了PyCharm。不是远程服务器。 此外,在大多数情况下,如果您想远程运行和调试代码,使用remote interpreter feature会更方便。

答案 1 :(得分:0)

我通过更改端口解决了这个问题。

相关问题