如何在kali-linux上安装pyscopg2?

时间:2019-07-15 13:45:32

标签: python python-3.x postgresql psycopg2

我正在尝试在kali-linux上安装pyscopg2 安装postgresql后,我尝试了:

$ sudo pip3 install pyscopg2

我得到以下信息:

ERROR: Complete output from command python setup.py egg_info:
    ERROR: running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-_hg2dt6y/psycopg2/

1) 我试过了:

$ sudo pip3 install postgresql-server-dev-X.Y

我得到以下信息:

ERROR: Could not find a version that satisfies the requirement postgresql-server-dev-X.Y (from versions: none)
ERROR: No matching distribution found for postgresql-server-dev-X.Y

我希望安装pyscopg2。

1 个答案:

答案 0 :(得分:1)

在Ubuntu 18中, 首先安装依赖项-

Foo doSomething1() { 
    try {
        return getVal();
    } finally {
        doSomeCleanup();
    }
}

然后转到您的环境并安装-

Foo doSomething2() { 
    final Foo result = getVal();
    doSomeCleanup();
    return result;
}