python - 在 Mac 上找不到 openssl/aes.h' 文件

标签 python macos encryption openssl

我正在尝试安装我发现的代理重新加密方案的 python 实现 here .

运行 $ sudo python setup.py install 时出现错误

fatal error :找不到“openssl/aes.h”文件

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

我试过了(全部取 self 找到的答案):

  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。

有什么想法吗?

最佳答案

首先检查$(brew --prefix openssl)/include指出的路径是否存在

如果上面没问题,你可以试试

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

查看:Nginx Cannot Find OpenSSL Development Headers

关于python - 在 Mac 上找不到 openssl/aes.h' 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45693149/

相关文章:

python - matplotlib 颜色条中的小刻度线

mysql - MAMP - 升级到 MySQL 5.6

c++ - 无法使用导出器类使用 assimp 导出模型

java - 提取文件中的值并将其转换为字符串以获得更多功能

python - 从 pytest fixture 返回多个对象

python - PyTorch - 类型错误 : forward() takes 1 positional argument but 2 were given

javascript - 编码用户输入以存储在 MongoDB 中

macos - 当表格滚动时,为什么 NSTextField 会在 NSTableView 上留下痕迹?

python - 在 Python 中使用套接字发送加密字符串

javascript - crypto-js aes 无法解密它加密的内容