我有一个全新安装的windows,我试图安装Postgres和pgAdmin 4。我做了一个全新安装的一切(pgAdmin 4,postrgres 13等)与默认设置。当我运行pgAdmin 4,我得到一个“致命错误:无法联系服务器”,并显示以下消息:
pgAdmin Runtime Environment
--------------------------------------------------------
Python Path: "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\python.exe"
Runtime Config File: "C:\Users\username\AppData\Roaming\pgadmin\runtime_config.json"
pgAdmin Config File: "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\config.py"
Webapp Path: "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py"
pgAdmin Command: "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\python.exe -s C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py"
Environment:
- ALLUSERSPROFILE: C:\ProgramData
- APPDATA: C:\Users\username\AppData\Roaming
- CHROME_CRASHPAD_PIPE_NAME: \\.\pipe\crashpad_4296_YJZESWNMDVNGRRUO
- CHROME_RESTART: NW.js|Whoa! NW.js has crashed. Relaunch now?|LEFT_TO_RIGHT
- CommonProgramFiles: C:\Program Files\Common Files
- CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
- CommonProgramW6432: C:\Program Files\Common Files
- COMPUTERNAME: pcname
- ComSpec: C:\Windows\system32\cmd.exe
- configsetroot: C:\Windows\ConfigSetRoot
- DriverData: C:\Windows\System32\Drivers\DriverData
- HOMEDRIVE: C:
- HOMEPATH: \Users\username
- LOCALAPPDATA: C:\Users\username\AppData\Local
- LOGONSERVER: \\pcname
- NUMBER_OF_PROCESSORS: 8
- NVM_HOME: C:\Users\username\AppData\Roaming\nvm
- NVM_SYMLINK: C:\Program Files\nodejs
- OneDrive: C:\Users\username\OneDrive
- OS: Windows_NT
- Path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\PostgreSQL\12\bin;C:\Users\username\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\username\AppData\Local\Microsoft\WindowsApps;C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin
- PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
- PGADMIN_INT_KEY: 2e023387-9c82-4cdd-af2f-c82562c6e4fc
- PGADMIN_INT_PORT: 50567
- PGADMIN_SERVER_MODE: OFF
- PROCESSOR_ARCHITECTURE: AMD64
- PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
- PROCESSOR_LEVEL: 6
- PROCESSOR_REVISION: 8c01
- ProgramData: C:\ProgramData
- ProgramFiles: C:\Program Files
- ProgramFiles(x86): C:\Program Files (x86)
- ProgramW6432: C:\Program Files
- PSModulePath: C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
- PUBLIC: C:\Users\Public
- SystemDrive: C:
- SystemRoot: C:\Windows
- TEMP: C:\Users\username\AppData\Local\Temp
- TMP: C:\Users\username\AppData\Local\Temp
- USERDOMAIN: pcname
- USERDOMAIN_ROAMINGPROFILE: pcname
- USERNAME: username
- USERPROFILE: C:\Users\username
- windir: C:\Windows
--------------------------------------------------------
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py", line 98, in <module>
app = create_app()
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\__init__.py", line 347, in create_app
if not os.path.exists(SQLITE_PATH) or get_version() == -1:
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\setup\db_version.py", line 19, in get_version
return version.value
AttributeError: 'NoneType' object has no attribute 'value'
- 注意:'username'和'pcname'是我替换实际字符串的占位符,其中一些字符串最初是大写的。*
已验证服务“postgresql-x64-13”正在运行。尽管尝试了以下操作,但我仍然收到此消息:
- 以管理员身份运行。
- 正在删除
C:\Users\username\AppData\Roaming\pgadmin
。 - 将
C:\Program Files\PostgreSQL\13\bin
添加到PATH
环境变量(系统和用户) - 正在重新启动服务。
- 卸载/重新安装Postgres 13.
- 卸载/安装Postgres 12.
- 重新启动我的机器。
产生不同结果的一件事是停止服务,删除C:\Users\username\AppData\Roaming\pgadmin,重新启动服务,然后运行pg 4admin,这导致了“致命错误”,输出如下:
pgAdmin Runtime Environment
--------------------------------------------------------
Python Path: "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\python.exe"
Runtime Config File: "C:\Users\username\AppData\Roaming\pgadmin\runtime_config.json"
pgAdmin Config File: "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\config.py"
Webapp Path: "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py"
pgAdmin Command: "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\python.exe -s C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py"
Environment:
- ALLUSERSPROFILE: C:\ProgramData
- APPDATA: C:\Users\username\AppData\Roaming
- CHROME_CRASHPAD_PIPE_NAME: \\.\pipe\crashpad_10312_CHCJAQAYYFQQIAGB
- CHROME_RESTART: NW.js|Whoa! NW.js has crashed. Relaunch now?|LEFT_TO_RIGHT
- CommonProgramFiles: C:\Program Files\Common Files
- CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
- CommonProgramW6432: C:\Program Files\Common Files
- COMPUTERNAME: pcname
- ComSpec: C:\Windows\system32\cmd.exe
- configsetroot: C:\Windows\ConfigSetRoot
- DriverData: C:\Windows\System32\Drivers\DriverData
- HOMEDRIVE: C:
- HOMEPATH: \Users\username
- LOCALAPPDATA: C:\Users\username\AppData\Local
- LOGONSERVER: \\pcname
- NUMBER_OF_PROCESSORS: 8
- NVM_HOME: C:\Users\username\AppData\Roaming\nvm
- NVM_SYMLINK: C:\Program Files\nodejs
- OneDrive: C:\Users\username\OneDrive
- OS: Windows_NT
- Path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\PostgreSQL\13\bin;C:\Users\username\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\username\AppData\Local\Microsoft\WindowsApps;C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\username\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\PostgreSQL\13\bin;
- PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
- PGADMIN_INT_KEY: cb6cf8e1-ca8b-416b-985f-1fd1a945ff06
- PGADMIN_INT_PORT: 50906
- PGADMIN_SERVER_MODE: OFF
- PROCESSOR_ARCHITECTURE: AMD64
- PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
- PROCESSOR_LEVEL: 6
- PROCESSOR_REVISION: 8c01
- ProgramData: C:\ProgramData
- ProgramFiles: C:\Program Files
- ProgramFiles(x86): C:\Program Files (x86)
- ProgramW6432: C:\Program Files
- PSModulePath: C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
- PUBLIC: C:\Users\Public
- SESSIONNAME: Console
- SystemDrive: C:
- SystemRoot: C:\Windows
- TEMP: C:\Users\username\AppData\Local\Temp
- TMP: C:\Users\username\AppData\Local\Temp
- USERDOMAIN: pcname
- USERDOMAIN_ROAMINGPROFILE: pcname
- USERNAME: username
- USERPROFILE: C:\Users\username
- windir: C:\Windows
--------------------------------------------------------
NOTE: Configuring authentication for DESKTOP mode.
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py", line 91, in <module>
exec(open(file_quote(setup_py), 'r').read())
File "<string>", line 506, in <module>
File "<string>", line 378, in setup_db
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\__init__.py", line 351, in create_app
db_upgrade(app)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\setup\db_upgrade.py", line 25, in db_upgrade
flask_migrate.upgrade(migration_folder)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_migrate\__init__.py", line 96, in wrapped
f(*args, **kwargs)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_migrate\__init__.py", line 271, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\command.py", line 294, in upgrade
script.run_env()
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\script\base.py", line 490, in run_env
util.load_python_file(self.dir, "env.py")
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\util\pyfiles.py", line 97, in load_python_file
module = load_module_py(module_id, path)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\util\compat.py", line 182, in load_module_py
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\setup\..\..\migrations\env.py", line 93, in <module>
run_migrations_online()
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\setup\..\..\migrations\env.py", line 86, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\runtime\environment.py", line 813, in run_migrations
self.get_context().run_migrations(**kw)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\runtime\migration.py", line 561, in run_migrations
step.migration_fn(**kw)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\migrations\versions\fdc58d9bd449_.py", line 122, in upgrade
Security(current_app, user_datastore, register_blueprint=False)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_security\core.py", line 1062, in __init__
self._state = self.init_app(
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_security\core.py", line 1102, in init_app
self._state = state = _get_state(app, datastore, **kwargs)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_security\core.py", line 608, in _get_state
remember_token_serializer=_get_serializer(app, "remember"),
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_security\core.py", line 593, in _get_serializer
return URLSafeTimedSerializer(secret_key=secret_key, salt=salt)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\itsdangerous\serializer.py", line 104, in __init__
self.secret_keys: _t.List[bytes] = _make_keys_list(secret_key)
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\itsdangerous\signer.py", line 64, in _make_keys_list
return [want_bytes(s) for s in secret_key]
TypeError: 'NoneType' object is not iterable
我最近在一台不同的机器上安装了这个,没有任何问题。看起来很奇怪,一个新的版本会有问题。几乎让我认为我缺少了旧版本包含的东西(python?),虽然这不应该是这样。有很多关于这个的帖子,我已经尝试了他们建议的一切,但没有解决方案。
9条答案
按热度按时间js5cn81o1#
正如Delsx在评论中指出的,独立的pgAdmin可以安装,而不会出现pgadmin.org/download中的相同问题。
nkoocmlb2#
最后,对我有效的解决方案是:
1.删除C:\用户\用户名\AppData\漫游\pgadmin
1.打开终端并使用python运行C:\Program Files\PostgreSQL \12\pgAdmin 4\web\pgAdmin4.py文件
Terminal view -> python execution
1.以管理员身份从窗口菜单运行“pgAdmin 4”应用程序,它将按预期工作
qgzx9mmu3#
我也遇到过这个问题。我按照nonethewiser的建议,安装了独立的pgAdmin。在删除了漫游/pgadmin并以管理员身份启动后,它不起作用。我再次尝试了捆绑的pgAdmin,奇怪的是,它起作用了。
rvpgvaaj4#
对我有效的解决方案:
下载pgAdmin4,网址为:https://www.postgresql.org/ftp/pgadmin/pgadmin4/v5.2/windows/下载Sql服务器位置:https://www.enterprisedb.com/downloads/postgres-postgresql-downloads设置时,取消选中安装pgAdmin 4和StackBuilder。
2j4z5cfb5#
我一直在搜索这个问题,并执行了以下操作
1.删除C:\Users\用户名\AppData\漫游\pgadmin文件夹
1.添加下一个windows用户环境变量
SQLITE_PATH = C:\用户* 您的用户名 *\应用程序数据\漫游\pgadmin\pgadmin4.db
1.在C:\Program Files\pgAdmin 4\v5\web中打开cmd,并使用python运行 setup.py 文件
1.安装所有缺少的依赖项(如果有)
1.setup.py 成功完成后,您应该再次从AppData中删除pgadmin文件夹
1.再次运行 * setup.py *
1.以正常方式打开pgAdming4(不以管理员身份)
此变通方法对我很有效
我的设置是PostgreSQL 9.6,pgAdmin4 v5.3和Python 3.9.5
jv4diomz6#
这个解决方案对我很有效:
仅从系统中删除pgAdmin4(在单个组件卸载模式下)。
然后下载并安装pgAdmin4,网址为:https://www.postgresql.org/ftp/pgadmin/pgadmin4/v5.2/windows/
删除C:\用户 * 您的用户名 *\AppData\漫游\pgadmin
运行PgAdmin4
bvuwiixz7#
如果连独立的pgAdmin 4 exe都不能运行,请转到python虚拟环境(如果没有,请使用pip安装)。在虚拟环境中安装pgAdmin包(pip install pgadmin 4)。导航到C:\Users(username)\Envs(或您各自的环境文件夹)\test(或您各自的环境名称)\Lib\site-packages\pgadmin 4\pgAdmin 4.py。如果在运行py文件时,您可能会遇到cheroot模块,但没有找到,请在虚拟环境中安装pip install cheroot,然后就完成了。记住在执行此操作之前要激活环境。为了方便起见,请在两个单独的cmd窗口中执行此操作。
即使exe不工作,上述过程也一定能工作。
同时验证postgresql是否正在侦听端口:5432否则更改postgresql.conf中的端口。
yws3nbqq8#
我在Linux Elementary OS上遇到了这个问题,解决我的问题的方法是将PgAdmin从端口5432配置到另一个端口,如5437**,因为pgAdmin在端口5432上启动时存在冲突,该端口已被Postgres使用
9ceoxa929#
同样的错误,我面临2天,但我不明白为什么它显示,只是我设置环境变量