通过 pip 安装 Python 模块

通过 pip 安装 Python 模块

我尝试在 Ubuntu 14.04.3 (x86_64) 中通过 pip3 安装“PyGreSQL”(pgdb) 模块

pip3 install PyGreSQL

但我有一个错误:

Downloading/unpacking PyGreSQL
Downloading PyGreSQL-5.0.4.tar.gz (637kB): 637kB downloaded
Running setup.py (path:/tmp/pip_build_root/PyGreSQL/setup.py) egg_info for package PyGreSQL
/bin/sh: 1: pg_config: not found
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/PyGreSQL/setup.py", line 88, in <module>
pg_version = pg_version()
File "/tmp/pip_build_root/PyGreSQL/setup.py", line 82, in pg_version
match = re.search(r'(\d+)\.(\d+)', pg_config('version'))
File "/tmp/pip_build_root/PyGreSQL/setup.py", line 74, in pg_config
raise Exception("pg_config tool is not available.")
Exception: pg_config tool is not available.
Complete output from command python setup.py egg_info:
/bin/sh: 1: pg_config: not found
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/PyGreSQL/setup.py", line 88, in <module>
pg_version = pg_version()
File "/tmp/pip_build_root/PyGreSQL/setup.py", line 82, in pg_version
match = re.search(r'(\d+)\.(\d+)', pg_config('version'))
File "/tmp/pip_build_root/PyGreSQL/setup.py", line 74, in pg_config
raise Exception("pg_config tool is not available.")
Exception: pg_config tool is not available.
  • python --version– Python 3.4.3

  • which pip3-/usr/bin/pip3

你能帮我解决这个问题吗?

答案1

您面临以下错误:

异常:pg_config 工具不可用。

pg_config工具是libpq-dev

您可以使用以下方式安装:

sudo apt-get install libpq-dev

相关内容