Solve the problem that openssl/opensslv. h cannot be found in centos.

Source: Internet
Author: User

Solve the problem that openssl/opensslv. h cannot be found in centos.

Introduction: scrapy is the most famous crawler framework in Python. When installing scrapy, scrapy encountered a problem where a file of openssl could not be found, analyzed, and recorded it.

1. scrapy and Installation Process

Scrapy is a famous crawler framework in Python. I installed it on Centos 7 and found the following problems:

> Pip install scrapy

Due to the large amount of information during the installation process, only the key parts are listed here:

[Html] view plaincopy
  1. Runningegg_info
  2. Writingrequirementstosrc/cryptography. egg-info/requires.txt
  3. Writingsrc/cryptography. egg-info/PKG-INFO
  4. Writingtop-levelnamestosrc/cryptography. egg-info/top_level.txt
  5. Writingdependency_linkstosrc/cryptography. egg-info/dependency_links.txt
  6. Writingentrypointstosrc/cryptography. egg-info/entry_points.txt
  7. Readingmanifestfile 'src/cryptography. egg-info/SOURCES.txt'
  8. Readingmanifesttemplate 'manifest. in'
  9. Nopreviusly-includeddirectoriesfoundmatching 'docs/_ build'
  10. Warning: nopreviusly-includedfilesmatching '* 'foundunderdirectory 'vectors'
  11. Writingmanifestfile 'src/cryptography. egg-info/SOURCES.txt'
  12. Runningbuild_ext
  13. Generatingcffimodule 'build/temp. linux-x86_64-2.7/_ padding. c'
  14. Creatingbuild/temp. linux-x86_64-2.7
  15. Generatingcffimodule 'build/temp. linux-x86_64-2.7/_ constant_time.c'
  16. Generatingcffimodule 'build/temp. linux-x86_64-2.7/_ openssl. c'
  17. Building '_ openssl' extension
  18. Creatingbuild/temp. linux-x86_64-2.7/build
  19. Creatingbuild/temp. linux-x86_64-2.7/build/temp. linux-x86_64-2.7
  20. 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-cbuild/temp. linux-x86_64-2.7/_ openssl. c-obuild/temp. linux-x86_64-2.7/build/temp. linux-x86_64-2.7/_ openssl. o
  21. Build/temp. linux-x86_64-2.7/_ openssl. c: 434: 30: fatalerror: openssl/opensslv. h: Nosuchfileordirectory
  22. # Include <openssl/opensslv. h>
  23. ^
  24. Compilationterminated.
  25. Error: command 'gcc 'failedwithexitstatus1
  26. ----------------------------------------
  27. Command "/usr/bin/python2-u-c" importsetuptools, 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" failedwitherrorcode1in/tmp/pip-build-hRMlG0/cryptography/
  28. [Root @ AY131203102210033c39Z ~] # Yuminstallopensslbuild/temp. linux-x86_64-2.7/_ openssl. c: 434: 30: fatalerror: openssl/opensslv. h: Nosuchfileordirectory
  29. ^ C
  30. Exitingonusercancel.
The openssl. c file fails to be installed, and the corresponding file does not appear to be found.

2. Problem Analysis

Check whether openssl is installed:

> Yum info openssl

[Html] view plaincopy
  1. Loadedplugins: fastestmirror
  2. Loadingtransferspeedsfromcachedhostfile
  3. * Base: mirrors.aliyun.com
  4. * Epel: mirrors.aliyun.com
  5. * Extras: mirrors.aliyun.com
  6. * Updates: mirrors.aliyun.com
  7. InstalledPackages
  8. Name: openssl
  9. Arch: x86_64
  10. Epoch: 1
  11. Version: 1.0.1e
  12. Release: 60. el7_3.1
  13. Size: 1.5 M
  14. Repo: installed
  15. Summary: UtilitiesfromthegeneralpurposecryptographylibrarywithTLSimplementation
  16. URL: http://www.openssl.org/
  17. License: OpenSSL
  18. Description: TheOpenSSLtoolkitprovidessupportforsecurecommunicationsbetween
  19. : Machines. OpenSSLincludesacertificatemanagementtoolandshared
  20. : Librarieswhichprovidevariouscryptographicalgorithmsand
  21. : Protocols.
Based on the information, we can know that openssl is an installed file. Why is it still missing the openssl. c file?

After some thought, we suddenly found a basic rule that openssl has installed a binary executable program, and here the installation of scrapy requires the openssl source file program, such as openssl. h. Therefore, we need to install the openssh. h development version, which contains the relevant installation source code file.

3. Problem Solving

After confirming the problem, install the openssl-devel installation package:

> Yum install openssl-devel

After the installation is complete, reinstall scrapy to successfully install scrapy.

4. Summary

By extension, there are similar problems in Linux systems. When installing a specific installation package, it depends on some third-party development kits, and some files cannot be found, generally, the development version of the dependent package needs to be installed. This rule should be generic.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.