2015-11-01 18 views
10

Tôi mới sử dụng mac và tôi không hiểu tại sao mẩu tin lưu niệm của tôi dường như không hoạt động nữa. Tôi nghi ngờ openssl không hợp lệ trong el capitan của tôi.Không tìm thấy biểu tượng: _BIO_new_CMS

tôi đã cố gắng:

pip install cryptography 
pip install pyOpenSSL 
brew install openssl 

và tôi vẫn nhận được lỗi dưới đây. Có cách nào tôi có thể sửa lỗi này không?

$ python 
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import OpenSSL 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module> 
    from OpenSSL import rand, crypto, SSL 
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/rand.py", line 11, in <module> 
    from OpenSSL._util import (
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/_util.py", line 3, in <module> 
    from cryptography.hazmat.bindings.openssl.binding import Binding 
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 13, in <module> 
    from cryptography.hazmat.bindings._openssl import ffi, lib 
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so, 2): Symbol not found: _BIO_new_CMS 
    Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so 
    Expected in: flat namespace 
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so 
>>> 
+0

thông tin ở đây: https://github.com/pyca/cryptography/issues/2138 – eLRuLL

+0

gì phiên bản của pip bạn đang sử dụng? Ngoài ra, đầu ra của 'otool -L/Library/Frameworks/Python.framework/Phiên bản/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so' là gì? Có vẻ như bạn đang cài đặt mật mã vào các gói Python toàn cầu của mình, thường là một lựa chọn không khôn ngoan, nhưng không có khả năng liên quan đến vấn đề này. Chỉnh sửa: Vì nó/Thư viện này có khả năng python.org python. Hãy thử gỡ cài đặt mật mã và sau đó chạy 'env LDFLAGS =" - L $ (brew --prefix openssl)/lib "CFLAGS =" - Tôi $ (brew --prefix openssl)/include "pip install cryptography' –

+0

@PaulKehrer Cảm ơn, apple python và python.org python được cung cấp vừa bị trộn lẫn. Sau khi thẳng lên đường dẫn lib nó cuối cùng đã làm việc. – suwopa

Trả lời

19

tôi giải quyết vấn đề này bằng lệnh sau:

LDFLAGS="-L/usr/local/opt/openssl/lib" pip install cryptography --no-use-wheel 

Tham khảo if homebrew openssl is linked, cryptography builds an unusable wheel

hơn
+1

Thêm bit LDFLAGS này trước khi lệnh pip giúp tôi cài đặt phế liệu trên OSX – saturdayplace

+0

hhh me too @saturdayplace –

+4

Lưu ý rằng lệnh này nên được chạy sau khi 'pip uninstall cryptography' để loại bỏ phiên bản đã cài đặt trước đó. –

Các vấn đề liên quan