我在尝试安装我找到的一个 Python 实现的代理重加密方案 这里 时遇到了问题。
运行命令 $ sudo python setup.py install
时,我得到了以下错误:
fatal error: 'openssl/aes.h' file not found
类似于这样的问题有一些(这个 或者 这个 (不适用于 Mac)),但是那里的任何答案都没有解决我的问题。
我尝试过以下方法(均来自我找到的答案):
- 运行命令
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography
并再次尝试; - 安装 OpenSSL:
brew install openssl
并再次尝试; - 重新安装 Python:
brew reinstall python
并再次尝试。
第一种方法返回:
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
命令会删除大部分常规用户的环境变量。例如env LDFLAGS=...
这样的选项会消失,除非你使用-e
和-E
等选项(如果我没记错的话)。请在非特权账户下构建项目,并使用 root 用户进行安装。 - jww