Linux中openssl/opensslv.h找不到问题的解决方法

 更新时间:2017年07月06日 10:37:49   作者:bladestone  
最近在安装scrapy过程中碰到了openssl某个文件找不到的问题,通过查找相关的资料进行了解决,下面这篇文章主要给大家分享了关于Linux中openssl/opensslv.h找不到问题的解决方法,需要的朋友可以参考借鉴,下面来一起看看吧。

前言

众所周知scrapy是Python中鼎鼎大名的爬虫框架,在安装scrapy过程中碰到了openssl某个文件找不到的问题,并进行了分析,记录之。

一、 scrapy以及安装过程

Scrapy是python中鼎鼎大名的爬虫框架,笔者在Centos 7系统之上进行安装,发现了如下问题:

   >> pip install scrapy

由于安装过程中的过程信息比较多,这里只列出了其中的关键片段信息:

 running egg_info 
 writing requirements to src/cryptography.egg-info/requires.txt 
 writing src/cryptography.egg-info/PKG-INFO 
 writing top-level names to src/cryptography.egg-info/top_level.txt 
 writing dependency_links to src/cryptography.egg-info/dependency_links.txt 
 writing entry points to src/cryptography.egg-info/entry_points.txt 
 reading manifest file 'src/cryptography.egg-info/SOURCES.txt' 
 reading manifest template 'MANIFEST.in' 
 no previously-included directories found matching 'docs/_build' 
 warning: no previously-included files matching '*' found under directory 'vectors' 
 writing manifest file 'src/cryptography.egg-info/SOURCES.txt' 
 running build_ext 
 generating cffi module 'build/temp.linux-x86_64-2.7/_padding.c' 
 creating build/temp.linux-x86_64-2.7 
 generating cffi module 'build/temp.linux-x86_64-2.7/_constant_time.c' 
 generating cffi module 'build/temp.linux-x86_64-2.7/_openssl.c' 
 building '_openssl' extension 
 creating build/temp.linux-x86_64-2.7/build 
 creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7 
 gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o 
 build/temp.linux-x86_64-2.7/_openssl.c:434:30: fatal error: openssl/opensslv.h: No such file or directory 
 #include <openssl/opensslv.h> 
     ^ 
 compilation terminated. 
 error: command 'gcc' failed with exit status 1 
 
 ---------------------------------------- 
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-hRMlG0/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ReCoWo-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-hRMlG0/cryptography/ 
[root@AY131203102210033c39Z ~]# yum install openssl build/temp.linux-x86_64-2.7/_openssl.c:434:30: fatal error: openssl/opensslv.h: No such file or directory 
^C 
 
Exiting on user cancel. 

由于确实openssl.c文件而安装失败了,貌似没有找到对应的文件

二、问题分析

首先怀疑openssl没有安装,故先进行openssl的检查:

  >> yum info openssl 

Loaded plugins: fastestmirror 
Loading mirror speeds from cached hostfile 
 * base: mirrors.aliyun.com 
 * epel: mirrors.aliyun.com 
 * extras: mirrors.aliyun.com 
 * updates: mirrors.aliyun.com 
Installed Packages 
Name : openssl 
Arch : x86_64 
Epoch : 1 
Version : 1.0.1e 
Release : 60.el7_3.1 
Size : 1.5 M 
Repo : installed 
Summary : Utilities from the general purpose cryptography library with TLS implementation 
URL  : http://www.openssl.org/ 
License : OpenSSL 
Description : The OpenSSL toolkit provides support for secure communications between 
  : machines. OpenSSL includes a certificate management tool and shared 
  : libraries which provide various cryptographic algorithms and 
  : protocols. 

基于其中的信息可以得知,openssl是一家安装过了,怎么还是会缺少openssl.c的文件呢?

经过一番思考,豁然发现一个基本规则, openssl已经安装二进制的可执行程序,而这里的安装scrapy则需要的是openssl的源文件程序,比如openssl.h。故这里需要补充安装的是openssh.h的开发版,其中包含相关的安装源代码文件。

三、问题的解决

在确认了问题之后,接下来就是安装openssl-devel的安装包了:

  >> yum install openssl-devel

在安装完成之后,重新安装scrapy,就可以顺利安装成功了

总结

推而广之,在Linux系统中都存在类似的问题,在安装特定安装包的过程中,其依赖某些第三方开发包,会曝出某些文件找不到的错误,一般情况下是需要安装依赖包的开发版本的。 这个规则应该是通用的。

好了,以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对脚本之家的支持。

相关文章

  • Linux如何重置root密码和修改用户密码

    Linux如何重置root密码和修改用户密码

    这篇文章主要介绍了Linux如何重置root密码和修改用户密码问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
    2024-03-03
  • 详解在Linux中怎么使用cron计划任务

    详解在Linux中怎么使用cron计划任务

    本篇文章主要介绍了在Linux中怎么使用cron计划任务,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2018-03-03
  • ubuntu中修改grub的启动时间生成

    ubuntu中修改grub的启动时间生成

    这篇文章主要介绍了ubuntu中修改grub的启动时间生成,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2019-10-10
  • Linux下Redis的安装和部署

    Linux下Redis的安装和部署

    这篇文章主要介绍了Linux下Redis的安装和部署的相关资料,需要的朋友可以参考下
    2016-02-02
  • 浅谈Linux中ldconfig和ldd的用法

    浅谈Linux中ldconfig和ldd的用法

    下面小编就为大家带来一篇浅谈Linux中ldconfig和ldd的用法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2016-12-12
  • 服务器安装宝塔面板无法远程连接数据库的解决方法

    服务器安装宝塔面板无法远程连接数据库的解决方法

    这篇文章主要介绍了服务器安装宝塔面板无法远程连接数据库的解决方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2020-06-06
  • hbase 简介

    hbase 简介

    HBase是基于GoogleBigTable模型开发的,典型的key/value系统;下面通过本文给大家介绍hbase的相关知识,感兴趣的朋友一起看看吧
    2017-09-09
  • linux开机启动nodemanager步骤

    linux开机启动nodemanager步骤

    这篇文章主要介绍了linux开机启动nodemanager的步骤,大家参考使用吧
    2014-01-01
  • 在Linux中列出Systemd下所有正在运行的服务的方法指南

    在Linux中列出Systemd下所有正在运行的服务的方法指南

    Systemd是Linux的系统和服务管理器; init进程的替代品,与SysV 和LSB init脚本兼容,systemctl命令是管理systemd的主要工具,在这篇文章中,我们将演示如何 Linux中列出systemd下所有正在运行的服务,感兴趣的同学可以借鉴阅读
    2023-06-06
  • 安装ubuntu18.04报:failed to load ldlinux.c32的问题及解决步骤

    安装ubuntu18.04报:failed to load ldlinux.c32的问题及解决步骤

    这篇文章主要介绍了安装ubuntu18.04报:failed to load ldlinux.c32的问题,本文通过图文并茂的形式给大家分享解决方法,需要的朋友可以参考下
    2020-08-08

最新评论