pgcli安装
pgcli安装:
https://github.com/dbcli/pgcli#detailed-installation-instructions
开始因为版本不符导致报错:
[root@sdbserver1 opt]# pip install typing
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==21.1.3', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 58
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
[root@sdbserver1 opt]# sudo pip install pgcli
Traceback (most recent call last):
File "/bin/pip", line 9, in <module>
load_entry_point('pip==21.1.3', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 58
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
查看python版本:
[root@sdbserver1 opt]# python -V
Python 2.7.5
python至少要3.6及以上,版本过低导致
安装python3.6
# wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
# tar xJf Python-3.6.3.tar.xz
# cd Python-3.6.3
# ./configure
# make
# make install
查看版本
# which python3
# python3 -V
安装pgcli
不适用pip使用pip3
which pip3
sudo yum install python-pip
sudo yum install python-devel postgresql-devel
sudo pip3 install pgcli
安装完后,输入命令可以提示: