Ubuntu16.04安装pycurl出错及解决方案

使用pip3安装pycurl出错:

    出错信息如下:

Running setup.py bdist_wheel for pycurl ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-848764ps/pycurl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpqo8isukqpip-wheel- --python-tag cp35:
  Using curl-config (libcurl 7.47.0)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  creating build/lib.linux-x86_64-3.5/curl
  copying python/curl/__init__.py -> build/lib.linux-x86_64-3.5/curl
  running build_ext
  building 'pycurl' extension
  creating build/temp.linux-x86_64-3.5
  creating build/temp.linux-x86_64-3.5/src
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_GNUTLS=1 -DHAVE_CURL_SSL=1 -I/usr/include/python3.5m -c src/docstrings.c -o build/temp.linux-x86_64-3.5/src/docstrings.o
  In file included from src/docstrings.c:4:0:
  src/pycurl.h:168:30: fatal error: gnutls/gnutls.h: 没有那个文件或目录
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for pycurl
  Running setup.py clean for pycurl
Failed to build pycurl
Installing collected packages: pycurl
  Running setup.py install for pycurl ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-848764ps/pycurl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-q76yy5qe-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    Using curl-config (libcurl 7.47.0)
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/curl
    copying python/curl/__init__.py -> build/lib.linux-x86_64-3.5/curl
    running build_ext
    building 'pycurl' extension
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/src
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_GNUTLS=1 -DHAVE_CURL_SSL=1 -I/usr/include/python3.5m -c src/docstrings.c -o build/temp.linux-x86_64-3.5/src/docstrings.o
    In file included from src/docstrings.c:4:0:
    src/pycurl.h:168:30: fatal error: gnutls/gnutls.h: 没有那个文件或目录
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-848764ps/pycurl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-q76yy5qe-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-848764ps/pycurl/

解决办法原文点击打开链接

缺少libgnutls28-dev依赖。

sudo apt-get install libgnutls28-dev

再次pip3 install pycurl

Running setup.py bdist_wheel for pycurl ... done
  Stored in directory: /home/wangfang/.cache/pip/wheels/d2/85/ae/ebf5ff0f1368869d082b4863df492bf54c661bf6306a2bdfde
Successfully built pycurl
Installing collected packages: pycurl
Successfully installed pycurl-7.43.0.2
安装成功。

你可能感兴趣的:(linux)