我对Python有相当丰富的经验,并且被困在了一个应该很简单的问题上。我在Mac上使用朱庇特笔记本。
我想用Python安装psycopg2,所以我输入了
import psycopg2 as pg2但是,我得到了以下错误:
ModuleNotFoundError Traceback (most recent call
last)
<ipython-input-1-32fa0c891bdd> in <module>
----> 1 import psycopg2 as pg2
ModuleNotFoundError: No module named 'psycopg2'然后我走到终点站,输入:
pip install psycopg2这导致了另一个错误:
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the
directory
containing pg_config to the $PATH or specify the full executable path
with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...我不知道如何在错误消息中使用这些信息。有人能帮我指出正确的方向吗?
另外,跟进问题:
a.)为什么我需要在终端中使用pip安装模块名,而我不需要对熊猫或胖熊猫这样做呢?
任何帮助都将不胜感激。
发布于 2020-02-15 19:35:25
由于您的计算机上可能没有安装所有C库依赖项,因此请尝试安装内核2-二进制文件。pip install psycopg2-binary
https://stackoverflow.com/questions/60242390
复制相似问题