批量升级 python 库遇到的问题及解决办法

批量升级 python 库需要用到 pip-review,先安装一下:

pip install pip-review

然后开始批量升级 python 库:

pip-review --interactive

不料遇到报错:

xattr.c:29:24: fatal error: attr/xattr.h: No such file or directory

解决一下:

sudo yum install -y libattr-devel

另外,尝试运行

yum install python-devel

结果,升级 pycurl 遇到问题:

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (none/other)

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.5 (default, Aug  4 2017, 00:39:18)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

解决方法如下:

pip uninstall pycurl
export PYCURL_SSL_LIBRARY=nss
easy_install pycurl

最后,再次尝试升级

pip-review --interactive

成功。

不过,还有一点提醒:

DEPRECATION: Uninstalling a distutils installed project (urlgrabber) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.

卸载 distutils 安装的 python 模块,只能部分卸载,也就是删不干净,所以这种卸载方法已标记为不推荐使用,并且将在未来的版本中彻底废弃。请勿依赖这种卸载方法。

本文链接:

https://dev.euyyue.com/note/362.html
1 + 2 =
快来做第一个评论的人吧~