python安装 pycurl
操作系统:CentOS7.6 64位
Python版本:3.6.8
安装pycurl的时候报错
ERROR: Command errored out with exit status 1:
command: /home/anaconda/miniconda3/envs/bdbp/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nwru_r0r/pycurl/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nwru_r0r/pycurl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-nwru_r0r/pycurl/pip-egg-info
cwd: /tmp/pip-install-nwru_r0r/pycurl/
Complete output (22 lines):
Traceback (most recent call last):
File "/tmp/pip-install-nwru_r0r/pycurl/setup.py", line 234, in configure_unix
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/home/anaconda/miniconda3/envs/bdbp/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/home/anaconda/miniconda3/envs/bdbp/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'curl-config': 'curl-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-nwru_r0r/pycurl/setup.py", line 961, in <module>
ext = get_extension(sys.argv, split_extension_source=split_extension_source)
File "/tmp/pip-install-nwru_r0r/pycurl/setup.py", line 623, in get_extension
ext_config = ExtensionConfiguration(argv)
File "/tmp/pip-install-nwru_r0r/pycurl/setup.py", line 101, in __init__
self.configure()
File "/tmp/pip-install-nwru_r0r/pycurl/setup.py", line 238, in configure_unix
raise ConfigurationError(msg)
__main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory: 'curl-config': 'curl-config'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
即无法查到"curl-config"这个文件,网上查下发现是因为CentOS自带的curl版本过低,下载安装更新高版本curl库。
wget https://curl.haxx.se/download/curl-7.68.0.tar.gz tar -zxf curl-7.68.0.tar.gz cd curl-7.68.0 ./configure make && make install vi /etc/profile.d/curl.sh export PATH=$PATH:/usr/local/curl/bin/ source /etc/profile
测试:curl -V
删除原来的libcurl库软链接,并新建链接
[[email protected] curl]# vi /etc/profile.d/curl.sh
[[email protected] curl]# source /etc/profile
[[email protected] curl]# curl -V
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.0.2k-fips zlib/1.2.7
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets
[[email protected] curl]# ll /usr/lib64/lib
Display all 928 possibilities? (y or n)
[[email protected] curl]# ll /usr/lib64/libcu
libcupscgi.so.1 libcupsmime.so.1 libcups.so.2 libcurl.so.4.3.0 libcursesw.so
libcupsimage.so.2 libcupsppdc.so.1 libcurl.so.4 libcurses.so
[[email protected] curl]# ll /usr/lib64/libcuul.so.4
ls: cannot access /usr/lib64/libcuul.so.4: No such file or directory
[[email protected] curl]# ll /usr/lib64/libcurl.so.4
libcurl.so.4 libcurl.so.4.3.0 libcurses.so libcursesw.so
[[email protected] curl]# ll /usr/lib64/libcurl.so.4
lrwxrwxrwx. 1 root root 16 Mar 8 17:02 /usr/lib64/libcurl.so.4 -> libcurl.so.4.3.0
[[email protected] curl]# ll /usr/local/lib |grep curl
-rw-r--r--. 1 root root 1006752 Apr 20 18:21 libcurl.a
-rwxr-xr-x. 1 root root 961 Apr 20 18:21 libcurl.la
lrwxrwxrwx. 1 root root 16 Apr 20 18:21 libcurl.so -> libcurl.so.4.6.0
lrwxrwxrwx. 1 root root 16 Apr 20 18:21 libcurl.so.4 -> libcurl.so.4.6.0
-rwxr-xr-x. 1 root root 534120 Apr 20 18:21 libcurl.so.4.6.0
[[email protected] curl]# rm -f /usr/lib64/libcurl.so.4*
[[email protected] curl]# ln -s /usr/local/lib/libcurl.so.4.6.0 /usr/lib64/libcurl.so.4.6.0
[[email protected] curl]# ln -s /usr/local/lib/libcurl.so.4.6.0 /usr/lib64/libcurl.so.4