在 Mac 上找不到 openssl/aes.h' 文件
Posted
技术标签:
【中文标题】在 Mac 上找不到 openssl/aes.h\' 文件【英文标题】:openssl/aes.h' file not found on Mac在 Mac 上找不到 openssl/aes.h' 文件 【发布时间】:2018-01-23 09:24:28 【问题描述】:我正在尝试安装我找到的代理重新加密方案的 python 实现here。
在运行$ sudo python setup.py install
时,我返回一个错误
fatal error: 'openssl/aes.h' file not found
周围有一些这样的问题(this 或 this(不适用于 mac)),但没有一个答案能解决我的问题。
我试过了(全部取自我找到的答案):
-
运行
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography
并重试;
brew install openssl
再试一次;
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。
有什么想法吗?
【问题讨论】:
sudo
丢掉了很多普通用户的环境。除非您使用像 -e
和 -E
(IIRC) 这样的选项,否则像 env LDFLAGS=...
这样的东西会消失。在非特权帐户下构建东西,并使用 root 安装。
【参考方案1】:
首先检查$(brew --prefix openssl)/include
指向的路径是否存在。
如果上面没问题,你可以试试
$ cd /usr/local/include
$ ln -s ../opt/openssl/include/openssl .
看:nginx Cannot Find OpenSSL Development Headers
【讨论】:
为我工作,当我在为 php 安装 gRPC 时遇到fatal error: 'openssl/rsa.h' file not found
时【参考方案2】:
遇到了cryptography==1.0.1
的这个问题。升级到2.9.2
。
【讨论】:
以上是关于在 Mac 上找不到 openssl/aes.h' 文件的主要内容,如果未能解决你的问题,请参考以下文章