Pgadmin4 无法在 python 3.6 和 Ubuntu 17.10 中运行

Pgadmin4 无法在 python 3.6 和 Ubuntu 17.10 中运行

我是新来的pgadmin4

我已经安装了 python 3.6。我尝试使用以下方法安装 pgAdmin4本指南

但我无法运行pgadmin

以下是我运行的命令,出现错误消息:

(pgadmin4) vadivel@vadivel:~/pgadmin4$ cd ~/pgadmin4
(pgadmin4) vadivel@vadivel:~/pgadmin4$ source bin/activate
(pgadmin4) vadivel@vadivel:~/pgadmin4$ python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py
/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.

错误:

Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/socketserver.py", line 641, in process_request_thread
    self.handle_error(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 639, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 200, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 235, in handle_one_request
    return self.run_wsgi()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1634, in full_dispatch_request
    self.try_trigger_before_first_request_functions()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1660, in try_trigger_before_first_request_functions
    func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/utils/__init__.py", line 43, in create_module_preference
    self.register_preferences()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/__init__.py", line 208, in register_preferences
    gettext("Show system objects?"), 'boolean', False,
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 539, in gettext
    t = get_translations()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 216, in get_translations
    catalog = support.Translations.load(dirname, [get_locale()])
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 244, in get_locale
    rv = babel.locale_selector_func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/__init__.py", line 269, in get_locale
    'miscellaneous', 'user_language', None, user_id
UnboundLocalError: local variable 'user_id' referenced before assignment

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/socketserver.py", line 641, in process_request_thread
    self.handle_error(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 639, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 200, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 235, in handle_one_request
    return self.run_wsgi()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1634, in full_dispatch_request
    self.try_trigger_before_first_request_functions()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1660, in try_trigger_before_first_request_functions
    func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/utils/__init__.py", line 43, in create_module_preference
    self.register_preferences()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/__init__.py", line 208, in register_preferences
    gettext("Show system objects?"), 'boolean', False,
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 539, in gettext
    t = get_translations()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 216, in get_translations
    catalog = support.Translations.load(dirname, [get_locale()])
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 244, in get_locale
    rv = babel.locale_selector_func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/__init__.py", line 269, in get_locale
    'miscellaneous', 'user_language', None, user_id
UnboundLocalError: local variable 'user_id' referenced before assignment

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/socketserver.py", line 641, in process_request_thread
    self.handle_error(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 639, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 200, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 235, in handle_one_request
    return self.run_wsgi()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1634, in full_dispatch_request
    self.try_trigger_before_first_request_functions()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1660, in try_trigger_before_first_request_functions
    func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/utils/__init__.py", line 43, in create_module_preference
    self.register_preferences()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/__init__.py", line 208, in register_preferences
    gettext("Show system objects?"), 'boolean', False,
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 539, in gettext
    t = get_translations()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 216, in get_translations
    catalog = support.Translations.load(dirname, [get_locale()])
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 244, in get_locale
    rv = babel.locale_selector_func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/__init__.py", line 269, in get_locale
    'miscellaneous', 'user_language', None, user_id
UnboundLocalError: local variable 'user_id' referenced before assignment

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/socketserver.py", line 641, in process_request_thread
    self.handle_error(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 639, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 200, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 235, in handle_one_request
    return self.run_wsgi()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1634, in full_dispatch_request
    self.try_trigger_before_first_request_functions()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1660, in try_trigger_before_first_request_functions
    func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/utils/__init__.py", line 43, in create_module_preference
    self.register_preferences()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/__init__.py", line 208, in register_preferences
    gettext("Show system objects?"), 'boolean', False,
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 539, in gettext
    t = get_translations()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 216, in get_translations
    catalog = support.Translations.load(dirname, [get_locale()])
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 244, in get_locale
    rv = babel.locale_selector_func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/__init__.py", line 269, in get_locale
    'miscellaneous', 'user_language', None, user_id
UnboundLocalError: local variable 'user_id' referenced before assignment

答案1

遇到了同样的问题,快速浏览后我发现代码进入此部分以确定语言,并且只有当“SERVER_MODE”设置为 False 时才会这样。我从配置中删除了该行,它就可以正常工作了。我确信有更好的解决方案,但这可以暂时提供帮助。

相关内容