pyspider安装失败报FileNotFoundError: [Errno 2] No such file or directory: 'curl-config'
2018-03-01 11:00
591 查看
操作系统:CentOS6.9 64位
Python版本:3.6.2
安装pyspider的时候报错:
后面试着单独安装pycurl的时候发现报我错误和这个是一样的。
看日志可以发现是安装pyspider的时候依赖于pycurl,于是程序就先安装pycurl了,版本是7.43.0.1,在安装pycurl的时候发现找不到”curl-config”这个文件,网上查下发现是因为CentOS自带的curl版本过低,
ok升级一下curl版本,这里选取与pycurl相同的版本,后来发现版本就算不同也是可以的
升级安装curl
Python版本:3.6.2
安装pyspider的时候报错:
[root@cm01 software]# pip3 install pyspider Collecting pyspider Using cached pyspider-0.3.9.tar.gz ... Collecting pycurl (from pyspider) Using cached pycurl-7.43.0.1.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "/tmp/pip-build-7572xl8l/pycurl/setup.py", line 104, in configure_unix stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "/usr/local/python3/lib/python3.6/subprocess.py", line 707, in __init__ restore_signals, start_new_session) File "/usr/local/python3/lib/python3.6/subprocess.py", line 1333, in _execute_child raise child_exception_type(errno_num, err_msg) FileNotFoundError: [Errno 2] No such file or directory: 'curl-config' ... __main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory: 'curl-config' ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-7572xl8l/pycurl/
后面试着单独安装pycurl的时候发现报我错误和这个是一样的。
看日志可以发现是安装pyspider的时候依赖于pycurl,于是程序就先安装pycurl了,版本是7.43.0.1,在安装pycurl的时候发现找不到”curl-config”这个文件,网上查下发现是因为CentOS自带的curl版本过低,
ok升级一下curl版本,这里选取与pycurl相同的版本,后来发现版本就算不同也是可以的
升级安装curl
第一步:下载curl
wget https://curl.haxx.se/download/curl-7.43.0.tar.gz[/code]第二步: 解压
tar -zxf curl-7.43.0.tar.gz第三步:编译
cd curl-7.43.0 ./configure第四步:安装
make && make install第五步:添加环境变量
vim /etc/profile # 添加下面的环境变量 PATH=$PATH:/usr/local/curl/bin/第六步:使环境变量生效
source /etc/profile第七步:测试curl是否配置成功
curl -V
此时再安装pyspider就成功了
当然你也可以先安装pycurl库再安装pyspiderpip3 install pyspider
这个时候还有一个小问题,你在使用Python进行import的时候可能是报下面的错误[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pycurl Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: pycurl: libcurl link-time version (7.19.7) is older than compile-time version (7.43.0) >>>
虽然curl已经升级了,但是libcurl库里还没有升级,把原来的删除,再做一下软链接就行
libcurl库的前缀是libcurl.so删除原来的libcurl库软链接
rm -f /usr/lib64/libcurl.so.4*
新安装的libcurl在/usr/local/lib/目录下查看新安装的lib
ll /usr/local/lib/ | grep curl在lib64目录下创建软链接指定libcurl.so库
ln -s /usr/local/lib/libcurl.so.4.3.0 /usr/lib64/libcurl.so.4.3.0 ln -s /usr/local/lib/libcurl.so.4.3.0 /usr/lib64/libcurl.so.4
再次导入pycurl模块就正常了
至此问题解决。
相关文章推荐
- pycurl安装报错:FileNotFoundError: [Errno 2] No such file or directory: 'curl-config'
- 安装 pyspider ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory
- ubuntu14.04安装pycurl报错: __main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory
- Could not run curl-config: [Errno 2] No such file or directory
- pip install pycurl "Error: Could not run curl-config: [Errno 2] No such file or directory"
- Could not run curl-config: [Errno 2] No such file or directory
- FileNotFoundError: [Errno 2] No such file or directory: 'traingingDigits/0_0.txt'
- mysql-python 安装错误: Cannot open include file: 'config-win.h': No such file or directory
- 关于安装MySQLdb出现fatal error: my_config.h: No such file or directory
- python文件操作的坑( FileNotFoundError: [Errno 2] No such file or directory...)
- cnmp安装失败,报错npm ERR! enoent ENOENT: no such file or directory,
- thrift 安装 make 失败 ar: .libs/ThriftTest_constants.o: No such file or directory
- win7 64 安装mysql-python:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
- python文件操作的坑( FileNotFoundError: [Errno 2] No such file or directory...)
- airflow 解决安装问题 OSError: [Errno 2] No such file or directory
- cnmp安装失败,报错npm ERR! enoent ENOENT: no such file or directory,
- FileNotFoundError_Errno 2_No such file or directory
- win7 64 安装mysql-python:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
- FileNotFoundError: [Errno 2] No such file or directory
- mysql-python 安装错误: Cannot open include file: 'config-win.h': No such file or directory