Python的pycurl库升级升级失败的解决方法

系统 1559 0

打算升级pycurl库,输入:pip install --upgrade pycurl,提示如下:

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting pycurl
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ac/b3/0f3979633b7890bab6098d84c84467030b807a1e2b31f5d30103af5a71ca/pycurl-7.43.0.3.tar.gz (215kB)
     |████████████████████████████████| 215kB 1.4MB/s
Building wheels for collected packages: pycurl
  Building wheel for pycurl (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d658jooi/pycurl/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d658jooi/pycurl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-1olx_50x --python-tag cp37
       cwd: /tmp/pip-install-d658jooi/pycurl/
  Complete output (22 lines):
  Using curl-config (libcurl 7.65.3)
  /tmp/pip-install-d658jooi/pycurl/setup.py:376: DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5
    dist_name, dist_version, _ = platform.dist()
  Warning: libcurl is configured to use SSL, but we have not been able to determine which SSL backend it is using. If your Curl is built against OpenSSL, LibreSSL, BoringSSL, GnuTLS, NSS or mbedTLS please specify the SSL backend manually. For other SSL backends please ignore this message.Not using an SSL library
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/curl
  copying python/curl/__init__.py -> build/lib.linux-x86_64-3.7/curl
  running build_ext
  building 'pycurl' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/src
  gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYCURL_VERSION="7.43.0.3" -DHAVE_CURL_SSL=1 -I/usr/include/python3.7m -c src/docstrings.c -o build/temp.linux-x86_64-3.7/src/docstrings.o
  In file included from src/docstrings.c:4:
  src/pycurl.h:4:10: fatal error: Python.h: No such file or directory
      4 | #include
        |          ^~~~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pycurl
  Running setup.py clean for pycurl
Failed to build pycurl
Installing collected packages: pycurl
  Found existing installation: pycurl 7.43.0.2
ERROR: Cannot uninstall 'pycurl'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

由错误提示,很明显,没有#include 头文件。。

安装一下python3-devel把。

输入:dnf install python3-devel,提示如下:

Last metadata expiration check: 0:56:56 ago on Sat 27 Jul 2019 06:12:55 PM CST.
Dependencies resolved.
=======================================================================================================================================
 Package                                   Architecture              Version                          Repository                  Size
=======================================================================================================================================
Installing:
 python3-devel                             x86_64                    3.7.3-3.fc30                     updates                    211 k
Installing dependencies:
 python3-rpm-generators                    noarch                    8-1.fc30                         updates                     23 k
 python-rpm-macros                         noarch                    3-42.fc30                        fedora                      11 k
 python-srpm-macros                        noarch                    3-42.fc30                        fedora                      11 k
 python3-rpm-macros                        noarch                    3-42.fc30                        fedora                      10 k

Transaction Summary
=======================================================================================================================================
Install  5 Packages

Total download size: 267 k
Installed size: 816 k
Is this ok [y/N]: y
Downloading Packages:
(1/5): python3-rpm-generators-8-1.fc30.noarch.rpm                                                      8.3 kB/s |  23 kB     00:02
(2/5): python-rpm-macros-3-42.fc30.noarch.rpm                                                          4.1 kB/s |  11 kB     00:02
(3/5): python-srpm-macros-3-42.fc30.noarch.rpm                                                          61 kB/s |  11 kB     00:00
(4/5): python3-rpm-macros-3-42.fc30.noarch.rpm                                                          51 kB/s |  10 kB     00:00
(5/5): python3-devel-3.7.3-3.fc30.x86_64.rpm                                                            68 kB/s | 211 kB     00:03
---------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                   31 kB/s | 267 kB     00:08
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                               1/1
  Installing       : python-srpm-macros-3-42.fc30.noarch                                                                           1/5
  Installing       : python-rpm-macros-3-42.fc30.noarch                                                                            2/5
  Installing       : python3-rpm-macros-3-42.fc30.noarch                                                                           3/5
  Installing       : python3-rpm-generators-8-1.fc30.noarch                                                                        4/5
  Installing       : python3-devel-3.7.3-3.fc30.x86_64                                                                             5/5
  Running scriptlet: python3-devel-3.7.3-3.fc30.x86_64                                                                             5/5
  Verifying        : python3-devel-3.7.3-3.fc30.x86_64                                                                             1/5
  Verifying        : python3-rpm-generators-8-1.fc30.noarch                                                                        2/5
  Verifying        : python-rpm-macros-3-42.fc30.noarch                                                                            3/5
  Verifying        : python-srpm-macros-3-42.fc30.noarch                                                                           4/5
  Verifying        : python3-rpm-macros-3-42.fc30.noarch                                                                           5/5

Installed:
  python3-devel-3.7.3-3.fc30.x86_64           python3-rpm-generators-8-1.fc30.noarch         python-rpm-macros-3-42.fc30.noarch
  python-srpm-macros-3-42.fc30.noarch         python3-rpm-macros-3-42.fc30.noarch

Complete!

安装很顺利,成功~

接着输入:pip install --upgrade pycurl,升级pycurl,提示如下错误:

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting pycurl
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ac/b3/0f3979633b7890bab6098d84c84467030b807a1e2b31f5d30103af5a71ca/pycurl-7.43.0.3.tar.gz (215kB)
     |████████████████████████████████| 215kB 976kB/s
Building wheels for collected packages: pycurl
  Building wheel for pycurl (setup.py) ... done
  Created wheel for pycurl: filename=pycurl-7.43.0.3-cp37-cp37m-linux_x86_64.whl size=295012 sha256=1910917c1325d6c4abf6e36f2bfa6f64e1869df0c13fc96c33e7d7ae4ceb13ac
  Stored in directory: /root/.cache/pip/wheels/79/4f/eb/a62d903e72f06bdccb8c945a31a12f3e481e84ea0b4b198104
Successfully built pycurl
Installing collected packages: pycurl
  Found existing installation: pycurl 7.43.0.2
ERROR: Cannot uninstall 'pycurl'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

OK,那就加上--ignore-installed选项吧。输入:pip install --upgrade --ignore-installed pycurl

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting pycurl
Installing collected packages: pycurl
Successfully installed pycurl-7.43.0.3

 至此,升级完全成功,大功告成~~~~


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论