python - 错误:尝试在 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
有没有人有办法解决吗?
谢谢
解决方案
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 ~]#
推荐阅读
- java - Grails 不能正确处理参数中的 unicode 字符
- flutter - Route 是什么意思
意思是? - snakemake - Snakemake:在一个输出目录中输出文件
- netcdf - 如何使用带有 GroupBy 的 xarray.apply_ufunc() 从 NetCDF 计算 ETP (Hargreaves)
- python - 将 ML 模型评分提取到新机器
- react-native - React Native:如何正确地将 renderItem 项传递给 FlatList,以便它们可以在另一个组件中呈现?
- google-analytics-api - 谷歌分析用户管理插入用户
- autodesk-forge - 通过数据管理 API 上传文件,但返回 403
- visual-studio-code - VS Code - 没有可用的默认代码段
- flutter - Flutter - Firebase auth onAuthStateChanged 不显示仪表板