Python3一些容易出现安装错误的模块

2018-09-18 993 0

安装mysql

CentOS

  1. sudo yum install mariadb-devel

MacOS

  1. brew install mysql

安装python-mysql

  1. pip install mysqlclient torndb

安装pycurl

如果安装pycurl时报错 No such file or directory: 'curl-config',安装openssl-dev

  1. sudo apt install libcurl4-openssl-dev libssl-dev
  2. sudo yum install libcurl-devel openssl-devel

CentOS等系统自带的libcurl一般都比较旧,推荐使用anaconda安装。

  1. conda install curl

由于libcurl的源码编译因素,在安装pycurl可能会导致以下两种错误。

错误1:ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)

错误2:ImportError: pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)

错误1的解决办法如下:

  1. pip uninstall pycurl -y
  2. export PYCURL_SSL_LIBRARY=openssl
  3. pip install pycurl --no-cache-dir

错误2的解决办法如下:

  1. pip uninstall pycurl -y
  2. export PYCURL_SSL_LIBRARY=nss
  3. pip install pycurl --no-cache-dir

如果使用nss安装的pycurl,没有XFERINFOFUNCTION属性,无法记录上传进度。