我无法访问我的Python控制台来运行脚本。我刚刚在Manjaro Linux 4.19上通过JetLab的tar文件安装了PyCharm 2019.3 Pro。我的执照很好。我已经在Setting>Project>Project Interpreter
和Settings>Build...>Console>Python Console
下设置了Python解释器。无法找出问题所在...
这是Python控制台输出的内容:
/home/XXXXX/miniconda3/bin/python /home/XXXXX/bin/pycharm-2019.3/plugins/python/helpers/pydev/pydevconsole.py --mode=client --port=33145
Traceback (most recent call last):
File "/home/XXXXX/bin/pycharm-2019.3/plugins/python/helpers/pydev/pydevconsole.py", line 482, in <module>
pydevconsole.start_client(host, port)
File "/home/XXXXX/bin/pycharm-2019.3/plugins/python/helpers/pydev/pydevconsole.py", line 395, in start_client
client, server_transport = make_rpc_client(client_service, host, port)
File "/home/XXXXX/bin/pycharm-2019.3/plugins/python/helpers/pydev/_pydev_comm/pydev_rpc.py", line 11, in make_rpc_client
client_transport, server_transport = open_transports_as_client((host, port))
File "/home/XXXXX/bin/pycharm-2019.3/plugins/python/helpers/pydev/_pydev_comm/pydev_transport.py", line 231, in open_transports_as_client
client_socket.connect(addr)
TimeoutError: [Errno 110] Connection timed out
Process finished with exit code 1
问题代码可能与socket
中的pydev_transport.py
模块调用有关:
def open_transports_as_client(addr):
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(addr) #Problem here? By the way addr=(host,port)
return _create_client_server_transports(client_socket)
答案 0 :(得分:0)
PyCharm似乎设置了host=localhost
似乎无效。
要进行快速修复,请设置host=127.0.0.1
。也就是说,我在pydevconsole.py
中编辑了主循环,并修改了客户端循环:
if mode == 'client':
if not port:
# port must be set for client
sys.exit(-1)
if not host:
from _pydev_bundle import pydev_localhost
host = client_host = "127.0.0.1"
# host = client_host = pydev_localhost.get_localhost()
pydevconsole.start_client(host, port)
elif mode == 'server':
pydevconsole.start_server(port)