操作系统:win7 x64
当我点击" python控制台"选项卡,我得到以下输出。 几个月前我成功启动了python控制台,但现在我不能。
"C:\Program Files\Python36\python.exe" "C:\Program Files\JetBrains\PyCharm 2017.2.3\helpers\pydev\pydevconsole.py" 52527 52528
PyDev console: starting.
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['D:\\2017编程\\python', 'D:/2017编程/python'])
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2017.2.3\helpers\pydev\_pydev_bundle\pydev_console_utils.py", line 257, in add_exec
self.finish_exec(more)
File "C:\Program Files\JetBrains\PyCharm 2017.2.3\helpers\pydev\_pydev_bundle\pydev_console_utils.py", line 434, in finish_exec
return server.NotifyFinished(more)
File "C:\Program Files\Python36\lib\xmlrpc\client.py", line 1112, in __call__
return self.__send(self.__name, args)
File "C:\Program Files\Python36\lib\xmlrpc\client.py", line 1452, in __request
verbose=self.__verbose
File "C:\Program Files\Python36\lib\xmlrpc\client.py", line 1154, in request
return self.single_request(host, handler, request_body, verbose)
File "C:\Program Files\Python36\lib\xmlrpc\client.py", line 1166, in single_request
http_conn = self.send_request(host, handler, request_body, verbose)
File "C:\Program Files\Python36\lib\xmlrpc\client.py", line 1279, in send_request
self.send_content(connection, request_body)
File "C:\Program Files\Python36\lib\xmlrpc\client.py", line 1309, in send_content
connection.endheaders(request_body)
File "C:\Program Files\Python36\lib\http\client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Program Files\Python36\lib\http\client.py", line 1026, in _send_output
self.send(msg)
File "C:\Program Files\Python36\lib\http\client.py", line 964, in send
self.connect()
File "C:\Program Files\Python36\lib\http\client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "C:\Program Files\Python36\lib\socket.py", line 722, in create_connection
raise err
File "C:\Program Files\Python36\lib\socket.py", line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。
终于解决了。 如果您使用本地DNS服务器,请将以下内容添加到主机。
::1 localhost
127.0.0.1 localhost
255.255.255.255 broadcasthost
fe80::1%lo0 localhost
答案 0 :(得分:0)
有些人在此报告了类似的问题:https://youtrack.jetbrains.com/issue/PY-7070
引用答案:
用户可以通过更改DNS服务器来解决问题 本地一个(由接入点提供)到谷歌DNS服务器 (8.8.8.8)。
它看起来像Mac OS Lion,后来没有先使用/ etc / hosts文件, 优先考虑DNS服务器,因此localhost可能会这样做 没有解决(但是,它不清楚为什么它不会回归 的/ etc /主机)。