【问题标题】:Scrapy Installation Fails with error 'cannot open include: 'openssl/aes.h 'Scrapy 安装失败并出现错误'无法打开包括:'openssl/aes.h'
【发布时间】:2014-08-29 12:44:18
【问题描述】:

我正在尝试使用easy_install -U Scrapy 安装 Scrapy,但在尝试安装时会出现一个奇怪的错误“无法打开包含文件”。有谁知道发生了什么?这是我的完整回溯:

C:\Users\Mubashar Kamran>easy_install -U Scrapy
Searching for Scrapy
Reading https://pypi.python.org/simple/Scrapy/
Best match: scrapy 0.24.4
Processing scrapy-0.24.4-py2.7.egg
scrapy 0.24.4 is already the active version in easy-install.pth
Installing scrapy-script.py script to C:\Python27\Scripts
Installing scrapy.exe script to C:\Python27\Scripts
Installing scrapy.exe.manifest script to C:\Python27\Scripts

Using c:\python27\lib\site-packages\scrapy-0.24.4-py2.7.egg
Processing dependencies for Scrapy
Searching for cryptography>=0.2.1
Reading https://pypi.python.org/simple/cryptography/
Best match: cryptography 0.5.4
Downloading https://pypi.python.org/packages/source/c/cryptography/cryptography-
0.5.4.tar.gz#md5=4fd1f10e9f99009a44667fabe7980aec
Processing cryptography-0.5.4.tar.gz
Writing c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cryptography-0.
5.4\setup.cfg
Running cryptography-0.5.4\setup.py -q bdist_egg --dist-dir c:\users\mubash~1\ap
pdata\local\temp\easy_install-jjms3i\cryptography-0.5.4\egg-dist-tmp-ry6bwd
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option:
 'setup_requires'
  warnings.warn(msg)
_Cryptography_cffi_684bb40axf342507b.c
   Creating library c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cry
ptography-0.5.4\cryptography\hazmat\primitives\__pycache__\Release\cryptography\
hazmat\primitives\__pycache__\_Cryptography_cffi_684bb40axf342507b.lib and objec
t c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cryptography-0.5.4\cr
yptography\hazmat\primitives\__pycache__\Release\cryptography\hazmat\primitives\
__pycache__\_Cryptography_cffi_684bb40axf342507b.exp
_Cryptography_cffi_8f86901cxc1767c5a.c
   Creating library c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cry
ptography-0.5.4\cryptography\hazmat\primitives\__pycache__\Release\cryptography\
hazmat\primitives\__pycache__\_Cryptography_cffi_8f86901cxc1767c5a.lib and objec
t c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cryptography-0.5.4\cr
yptography\hazmat\primitives\__pycache__\Release\cryptography\hazmat\primitives\
__pycache__\_Cryptography_cffi_8f86901cxc1767c5a.exp
_Cryptography_cffi_4ed9e37dx4000d087.c
cryptography\hazmat\bindings\__pycache__\_Cryptography_cffi_4ed9e37dx4000d087.c(
194) : fatal error C1083: Cannot open include file: 'openssl/aes.h': No such fil
e or directory
error: c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cryptography-0.5
.4\cryptography\hazmat\primitives\__pycache__\_Cryptography_cffi_684bb40axf34250
7b.pyd: Access is denied

【问题讨论】:

    标签: python installation scrapy easy-install


    【解决方案1】:

    我在安装不同的 python 应用程序时遇到了同样的错误。我缺少 OpenSSL 开发包,通过以下方式解决:

    sudo apt-get install libssl-dev
    

    【讨论】:

      【解决方案2】:

      在 OSX 上

      brew install openssl,然后可能是brew link openssl --force,如果你被告知链接没有创建。

      使用以下命令安装 Scrapy

      env CRYPTOGRAPHY_OSX_NO_LINK_FLAGS=1 LDFLAGS="$(brew --prefix openssl)/lib/libssl.a $(brew --prefix openssl)/lib/libcrypto.a" CFLAGS="-I$(brew --prefix openssl)/include" pip install scrapy

      如果您愿意,可以将 openssl 替换为 libressl。

      【讨论】:

      • brew link openssl --force 在/usr/local/include 中添加了相应的符号链接,为我解决了问题。
      • brew links openssl --force 也为我工作。之后,pip install scrapy 运行完成。
      【解决方案3】:

      安装openssl就够了

      brew install openssl
      

      并导出

      export LDFLAGS=-L/usr/local/opt/openssl/lib
      export CPPFLAGS=-I/usr/local/opt/openssl/include
      

      在 ~/.bash_profile 中。 尽量避免与 --force 参数链接,因为它可能导致与系统库的冲突。

      【讨论】:

      • 被授予的问题提问者可以推断出 Windows,感谢 Pavel 作为 OSX 用户,这是我需要的助推器。
      【解决方案4】:

      所有在安装scrapy时遇到错误的人都应该关注http://community.spiceworks.com/how_to/38490-setting-up-scrapy-on-windows-7。此链接描述了在 Windows 7 和 8 上安装 scrapy 且不会遇到任何错误的最准确、最简单的方法。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-06-11
        • 2014-09-24
        • 2012-10-23
        • 1970-01-01
        • 2017-08-28
        • 1970-01-01
        • 2021-07-31
        • 2019-07-06
        相关资源
        最近更新 更多