首页 > 解决方案 > 错误:尝试在 CentOS 7 上安装 pgAdmin 4 Web 界面

问题描述

[root@pgdb-0 pgadmin]# python /usr/lib/python3.6/site-packages/pgadmin4-web/setup.py
NOTE: Configuring authentication for SERVER mode.

Enter the email address and password to use for the initial pgAdmin user account:

Email address: admin@example.com

导致错误:

  File "/usr/lib/python3.6/site-packages/pgadmin4-web/migrations/versions/fdc58d9bd449_.py", line 43, in upgrade
email, password = user_info()
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/setup/user_info.py", line 51, in user_info
email = input("Email address: ")
  File "<string>", line 1
admin@example.com
     ^
SyntaxError: invalid syntax

如果我将电子邮件地址用单引号或双引号括起来,则会收到另一个错误:

  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/driver/psycopg2/connection.py", line 38, in <module>
from pgadmin.utils import csv
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/csv.py", line 651, in <module>
register_dialect("excel", excel)
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/csv.py", line 486, in register_dialect
raise TypeError('"name" must be a string')
TypeError: "name" must be a string

[root@pgdb-0 pgadmin]# python -V
Python 2.7.5

有没有人有办法解决吗?

谢谢

标签: pythonpgadmin

解决方案


python --version

如果它2.7需要这样做(如果你已经从你那里改变版本3.5


首先注册 python2 作为替代

alternatives --install /usr/bin/python python /usr/bin/python2 50

注册python3.5作为替代

alternatives --install /usr/bin/python python /usr/bin/python3.5 60

选择要使用的python

alternatives --config python

python --version 

检查你是否有 3 个我的结果:

===============================

    [root@localhost ~]# alternatives --install /usr/bin/python python /usr/bin/python2 50
    [root@localhost ~]# alternatives --install /usr/bin/python python /usr/bin/python3.6 60
    [root@localhost ~]# alternatives --config python

There are 2 programs which provide 'python'.

  Selection    Command
-----------------------------------------------
   1           /usr/bin/python2
*+ 2           /usr/bin/python3.6

Enter to keep the current selection[+], or type selection number: 2
[root@localhost ~]# python --version
Python 3.6.8
[root@localhost ~]# python /usr/lib/python3.6/site-packages/pgadmin4-web/setup.py
NOTE: Configuring authentication for SERVER mode.

Enter the email address and password to use for the initial pgAdmin user account:

Email address: ****@mail.ru
Password:
Retype password:
pgAdmin 4 - Application Initialisation
======================================

[root@localhost ~]#

推荐阅读