Mac下pip安装cryptography时报openssl not found

Mac上使用pip安装cryptography时,发现怎么安装都会报下面的错误:

 build/temp.macosx-10.9-x86_64-3.7/_openssl.c:493:10: fatal error: 'openssl/opensslv.h' file not found
    #include <openssl/opensslv.h>
             ^~~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1

先检查你的openssl有没有安装,

brew install openssl

如果已经安装的话,执行这句话:

pip install cryptography --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include"

他指定了OpenSSL的路径

猜你喜欢

转载自blog.csdn.net/youshaoduo/article/details/81086267