通过pip为python安装模块

Ole*_*sii 2 command-line python3 software-installation 14.04 pip

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

pip3 install PyGreSQL
Run Code Online (Sandbox Code Playgroud)

但我有一个错误:

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.
Run Code Online (Sandbox Code Playgroud)
  • python --version - Python 3.4.3

  • which pip3 —— /usr/bin/pip3

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

Yar*_*ron 9

您正面临以下错误:

例外:pg_config 工具不可用。

pg_config工具是libpq-dev

您可以使用以下方法安装它:

sudo apt-get install libpq-dev
Run Code Online (Sandbox Code Playgroud)

  • @Oleksii - 太棒了!如果我的回答解决了您的问题,请[接受](https://askubuntu.com/help/someone-answers) (2认同)