openssl/aes.h' 文件

问题描述 投票:0回答:3

我正在尝试安装我在here找到的代理重新加密方案的Python实现。

运行时

$ sudo python setup.py install
我收到错误

fatal error: 'openssl/aes.h' file not found

有一些类似的问题(thisthis(不适用于Mac)),但那里的答案都没有解决我的问题。

我已经尝试过(全部取自我找到的答案):

  1. 运行
    env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography
    并重试;
  2. brew install openssl
    ,然后再试一次;
  3. brew reinstall python
    ,然后再试一次;

选项1.退回

Requirement already satisfied: cryptography in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requirement already satisfied: six>=1.4.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: setuptools>=11.3 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: cffi>=1.4.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: pyasn1>=0.1.8 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: enum34 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: ipaddress in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: idna>=2.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cffi>=1.4.1->cryptography)

我运行的是 OSX 10.12.6。

有什么想法吗?

python macos encryption openssl
3个回答
24
投票

首先检查

$(brew --prefix openssl)/include
所指的路径是否存在。

如果以上没问题,你可以尝试一下

$ cd /usr/local/include
$ ln -s ../opt/openssl/include/openssl .

查看:Nginx 找不到 OpenSSL 开发标头


3
投票

指定环境变量解决了我的问题:

For MacOS users:

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. This means that you will need to export some OpenSSL settings yourself.

Use the following commands:

export CFLAGS="-I$(brew --prefix openssl)/include"
export LDFLAGS="-L$(brew --prefix openssl)/lib"

0
投票

面对这个问题

cryptography==1.0.1
。升级为
2.9.2

© www.soinside.com 2019 - 2024. All rights reserved.