安装curl支持http2.0的步骤 及nghttp2安装 nghttp2的python模组

来源:互联网 发布:纯t是什么意思网络用语 编辑:程序博客网 时间:2024/06/05 06:48


python 没有http2.0的支持组件,查到nghttp2有做一个python的module,curl支持http2就是使用nghttp2这个第三方工具

安装nghttp2

安装nghttp2的python模组必须python为dev模式,python3.5以上支持asyncio1.先安装python3-dev(编译python module时需要) sudo apt-get install python3-dev ,debian jessie 此版为3.4,因此要自行安装dev版 ubuntu 16.04版支持python3-dev 3.5以上版本
2.https://github.com/nghttp2/nghttp2   下载打包文件  https://github.com/nghttp2/nghttp2/releases/download/v1.23.1/nghttp2-1.23.1.tar.gz
3.预先安装 的包   If you are using Ubuntu 16.04 LTS (Xenial Xerus) or Debian 8 (jessie) and above, run the following to install the required packages:  sudo apt-get install g++ make binutils autoconf automake autotools-dev libtool pkg-config \  zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev    libjansson-dev \  libc-ares-dev libjemalloc-dev libsystemd-dev libspdylay-dev \  cython python3-dev python-setuptools  在ubuntu中,要安装pip   sudo apt install python3-pip
4.安装 nghttp2 如有多个python,指定python 版本 ./configure PYTHON=/usr/local/bin/python3.5 PYTHON_VERSION=3.5   make   sudo make install 出现错误的话执行下面的命令
4.1 执行 sudo ldconfig否则在python中调用import nghttp2会出错误ImportError: libnghttp2.so.14: cannot open shared object file: No such file or directory以上nghttp2安装完成,进入python3,import nghttp2 可以看到已安装完成python module

安装 curl

如需使用curl 支持http2则需安装 新的curl https://github.com/curl/curl 下载源文件 7.47.0 以上版本支持
  下载 https://github.com/curl/curl/files/1101227/curl-7.54.1.tar.gz  解压并安装./configure --with-nghttp2=/usr/local   其中/usr/local为nghttp所安装的目录,根据情况设定  make  sudo make install

原创粉丝点击