簡體   English   中英

如何使用 Docker for Mac 在 Pycharm 中使用 python 控制台

[英]How to use python console in Pycharm using Docker for Mac

當我使用 docker compose 在 pycharm 中運行 docker-compose 應用程序時,我無法連接到 python 控制台。 所有的配置似乎都很好。 Pycharm 掃描具有所有要求的解釋器。 但是當我打開python console我收到一個錯誤:

    018, 21:07:40) 
  [GCC 6.3.0 20170516] on linux
  Traceback (most recent call last):
  File "/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 303, in run
    self._on_run()
  File "/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 1521, in _on_run
    self.send_result(xml)
  File "/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 1543, in send_result
    self.frame_accessor.ReturnFullValue(self.seq, xml.getvalue())
  File "/opt/python3.6/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/opt/python3.6/lib/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/opt/python3.6/lib/python3.6/xmlrpc/client.py", line 1154, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/opt/python3.6/lib/python3.6/xmlrpc/client.py", line 1166, in single_request
    http_conn = self.send_request(host, handler, request_body, verbose)
  File "/opt/python3.6/lib/python3.6/xmlrpc/client.py", line 1279, in send_request
    self.send_content(connection, request_body)
  File "/opt/python3.6/lib/python3.6/xmlrpc/client.py", line 1309, in send_content
    connection.endheaders(request_body)
  File "/opt/python3.6/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/opt/python3.6/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/opt/python3.6/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/opt/python3.6/lib/python3.6/http/client.py", line 936, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/opt/python3.6/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/opt/python3.6/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno -2] Name or service not known      

此問題已修復。 Pycharm可以通過python控制台連接docker-compose解釋器

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM