无法在 ubuntu 16.04 python 2.7.12 上安装 pycurl==7.19.0

Can't install pycurl==7.19.0 on ubuntu 16.04 python 2.7.12

Ubuntu - 16.04 Python - 2.7.12

大家好,我正在尝试从 setup.py 安装 pycurl==7.19.0,但是捕获了这个堆栈跟踪:

Downloading https://pypi.python.org/packages/11/73/abcfbbb6e1dd7087fa53042c301c056c11264e8a737a4688f834162d731e/pycurl-7.19.0.tar.gz#md5=074cd44079bb68697f5d8751102b384b
Best match: pycurl 7.19.0
Processing pycurl-7.19.0.tar.gz
Writing /tmp/easy_install-F8gcvD/pycurl-7.19.0/setup.cfg
Running pycurl-7.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-F8gcvD/pycurl-7.19.0/egg-dist-tmp-8sbXeG
Using curl-config (libcurl 7.47.0)
src/pycurl.c: In function ‘multi_socket_callback’:
src/pycurl.c:2351:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
     int ret;
         ^
src/pycurl.c: In function ‘initpycurl’:
src/pycurl.c:3453:31: warning: macro "__DATE__" might prevent reproducible builds [-Wdate-time]
     insstr(d, "COMPILE_DATE", __DATE__ " " __TIME__);
                               ^
src/pycurl.c:3453:44: warning: macro "__TIME__" might prevent reproducible builds [-Wdate-time]
     insstr(d, "COMPILE_DATE", __DATE__ " " __TIME__);
                                            ^
/usr/bin/ld: cannot find -lidn
/usr/bin/ld: cannot find -lrtmp
/usr/bin/ld: cannot find -lgssapi_krb5
/usr/bin/ld: cannot find -lkrb5
/usr/bin/ld: cannot find -lk5crypto
/usr/bin/ld: cannot find -lcom_err
/usr/bin/ld: cannot find -llber
/usr/bin/ld: cannot find -llber
/usr/bin/ld: cannot find -lldap
collect2: error: ld returned 1 exit status
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

有谁知道哪里出了问题?

尝试:sudo apt-get install python-dev

这些行:

/usr/bin/ld: cannot find -lidn
/usr/bin/ld: cannot find -lrtmp
/usr/bin/ld: cannot find -lgssapi_krb5
/usr/bin/ld: cannot find -lkrb5
/usr/bin/ld: cannot find -lk5crypto
/usr/bin/ld: cannot find -lcom_err
/usr/bin/ld: cannot find -llber
/usr/bin/ld: cannot find -llber
/usr/bin/ld: cannot find -lldap

表示库 idnrtmpgssapi_krb5krb5k5cryptocom_errlber、并且找不到 ldap,这很可能意味着它们没有安装。我检查了libcurl3的依赖,它直接依赖于gssapi-krb5-2(依赖于krb5-3k5crypto3),idn11ldaprtmp1, ssl1.

所以,安装 libcurl3 应该可以解决您的问题:

sudo apt-get install libcurl3

安装完成后,再次尝试安装 pycurl

我不知道,我尝试了所有方法,我认为我在安装 pip 时遇到了问题,我通常使用 sudo pip install...。所以也许有些库没有读取权限。我用空 ubuntu 恢复了快照并再次安装所有库,没有 'SUDO' pip 安装,非常感谢所有答案。