对于收到此错误但原因略有不同的其他人,您可以执行以下操作进行故障排除。通过右键单击并选择以管理员身份运行来打开文本编辑器。打开 C:\Program Files\pgAdmin 4\v4\web\pgAdmin4.py 并添加一行代码,没有其他任何内容。输出将截然不同且很有帮助。您可以在系统托盘 > pgAdmin > 查看日志中找到错误。
import traceback # <--- add this line too.
try:
app.run(
host=config.DEFAULT_SERVER,
port=config.EFFECTIVE_SERVER_PORT,
use_reloader=(
(not app.PGADMIN_RUNTIME) and app.debug and
os.environ.get("WERKZEUG_RUN_MAIN") is not None
),
threaded=config.THREADED_MODE
)
except IOError:
#app.logger.error("Error starting the app server: %s", sys.exc_info())
app.logger.error("Error starting the app server: %s", traceback.format_exc()) # <--- add this line!
而不是这个:
ERROR flask.app: Error starting the app server: (<class 'OSError'>, OSError(10013, 'An attempt was made to access a socket in a way forbidden by its access permissions', None, 10013, None),
你会得到这个:
2021-03-01 11:38:33,817: ERROR flask.app: Error starting the app server: (<class 'OSError'>, OSError(10013, 'An attempt was made to access a socket in a way forbidden by its access permissions', None, 10013, None), <traceback object at 0x00000279EF74A3C0>)
Traceback (most recent call last):
File "C:/Program Files/pgAdmin 4/v4/web/pgAdmin4.py", line 210, in main
app.run(
File "C:/Program Files/pgAdmin 4/v4/venv/Lib/site-packages\flask\app.py", line 943, in run
run_simple(host, port, self, **options)
File "C:/Program Files/pgAdmin 4/v4/venv/Lib/site-packages\werkzeug\serving.py", line 1052, in run_simple
inner()
File "C:/Program Files/pgAdmin 4/v4/venv/Lib/site-packages\werkzeug\serving.py", line 996, in inner
srv = make_server(
File "C:/Program Files/pgAdmin 4/v4/venv/Lib/site-packages\werkzeug\serving.py", line 847, in make_server
return ThreadedWSGIServer(
File "C:/Program Files/pgAdmin 4/v4/venv/Lib/site-packages\werkzeug\serving.py", line 740, in __init__
HTTPServer.__init__(self, server_address, handler)
File "C:/Program Files/pgAdmin 4/v4/venv/Lib\socketserver.py", line 452, in __init__
self.server_bind()
File "C:/Program Files/pgAdmin 4/v4/venv/Lib\http\server.py", line 138, in server_bind
socketserver.TCPServer.server_bind(self)
File "C:/Program Files/pgAdmin 4/v4/venv/Lib\socketserver.py", line 466, in server_bind
self.socket.bind(self.server_address)
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions