Cryptography 无法在OSX 10.8上安装加密0.9.3

Cryptography 无法在OSX 10.8上安装加密0.9.3,cryptography,pycparser,Cryptography,Pycparser,我不熟悉python和django。自从django的最新版本发布以来,我一直在努力在本地安装我们公司的开发包。下面是消息堆栈: Installing django. django: There's no directory named after our project. Probably you want to run 'bin/django startproject project' Getting distribution for 'cryptography>=0.7'. Ins

我不熟悉python和django。自从django的最新版本发布以来,我一直在努力在本地安装我们公司的开发包。下面是消息堆栈:

Installing django.
django: There's no directory named after our project. Probably you want to run 'bin/django startproject project'
Getting distribution for 'cryptography>=0.7'.

Installed /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs/cffi-1.1.2-py2.7-macosx-10.8-x86_64.egg
Searching for ipaddress
Reading https://pypi.python.org/simple/ipaddress/
Best match: ipaddress 1.0.14
Downloading https://pypi.python.org/packages/source/i/ipaddress/ipaddress-1.0.14.tar.gz#md5=e2f2f6593b2b8a7e8abba0fbdf33f046
Processing ipaddress-1.0.14.tar.gz
Writing /var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/temp/easy_install-Q3JRP9/ipaddress-1.0.14/setup.cfg
Running ipaddress-1.0.14/setup.py -q bdist_egg --dist-dir /var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/temp/easy_install-Q3JRP9/ipaddress-1.0.14/egg-dist-tmp-QxA7aQ
zip_safe flag not set; analyzing archive contents...
Copying ipaddress-1.0.14-py2.7.egg to /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs

Installed /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs/ipaddress-1.0.14-py2.7.egg
Searching for enum34
Reading https://pypi.python.org/simple/enum34/
Best match: enum34 1.0.4
Downloading https://pypi.python.org/packages/source/e/enum34/enum34-1.0.4.zip#md5=9843e97527f3126c851df7afeb0524b3
Processing enum34-1.0.4.zip
Writing /var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/temp/easy_install-GiulwR/enum34-1.0.4/setup.cfg
Running enum34-1.0.4/setup.py -q bdist_egg --dist-dir /var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/temp/easy_install-GiulwR/enum34-1.0.4/egg-dist-tmp-NSgjuy
zip_safe flag not set; analyzing archive contents...
Copying enum34-1.0.4-py2.7.egg to /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs

Installed /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs/enum34-1.0.4-py2.7.egg
Searching for six>=1.4.1
Reading https://pypi.python.org/simple/six/
Best match: six 1.9.0
Downloading https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz#md5=476881ef4012262dfc8adc645ee786c4
Processing six-1.9.0.tar.gz
Writing /var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/temp/easy_install-xWVhoY/six-1.9.0/setup.cfg
Running six-1.9.0/setup.py -q bdist_egg --dist-dir /var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/temp/easy_install-xWVhoY/six-1.9.0/egg-dist-tmp-WO8SGv
no previously-included directories found matching 'documentation/_build'
zip_safe flag not set; analyzing archive contents...
six: module references __path__
creating /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs/six-1.9.0-py2.7.egg
Extracting six-1.9.0-py2.7.egg to /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs

Installed /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs/six-1.9.0-py2.7.egg
Searching for pyasn1
Reading https://pypi.python.org/simple/pyasn1/
Best match: pyasn1 0.1.8
Downloading https://pypi.python.org/packages/2.7/p/pyasn1/pyasn1-0.1.8-py2.7.egg#md5=59f23a2692b9b4bc7901d166eba69167
Processing pyasn1-0.1.8-py2.7.egg
Moving pyasn1-0.1.8-py2.7.egg to /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs

Installed /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs/pyasn1-0.1.8-py2.7.egg
Searching for idna
Reading https://pypi.python.org/simple/idna/
Best match: idna 2.0
Downloading https://pypi.python.org/packages/source/i/idna/idna-2.0.tar.gz#md5=bd17a9d15e755375f48a62c13b25b801
Processing idna-2.0.tar.gz
Writing /var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/temp/easy_install-ne4LbF/idna-2.0/setup.cfg
Running idna-2.0/setup.py -q bdist_egg --dist-dir /var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/temp/easy_install-ne4LbF/idna-2.0/egg-dist-tmp-8YLfu7
warning: no previously-included files matching '*.pyc' found under directory 'tools'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
zip_safe flag not set; analyzing archive contents...
Copying idna-2.0-py2.7.egg to /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs

Installed /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs/idna-2.0-py2.7.egg
Searching for pycparser
Reading https://pypi.python.org/simple/pycparser/
Best match: pycparser 2.14
Downloading https://pypi.python.org/packages/source/p/pycparser/pycparser-2.14.tar.gz#md5=a2bc8d28c923b4fe2b2c3b4b51a4f935
Processing pycparser-2.14.tar.gz
Writing /var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/temp/easy_install-M45io9/pycparser-2.14/setup.cfg
Running pycparser-2.14/setup.py -q bdist_egg --dist-dir /var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/temp/easy_install-M45io9/pycparser-2.14/egg-dist-tmp-TZWoS1
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
zip_safe flag not set; analyzing archive contents...
Copying pycparser-2.14-py2.7.egg to /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs

Installed /private/var/folders/hf/y3d63zk55893w65jr6dxpk5m0000gn/T/easy_install-bi2ZfW/cryptography-0.9.3/.eggs/pycparser-2.14-py2.7.egg
no previously-included directories found matching 'docs/_build'
warning: no previously-included files matching '*' found under directory 'vectors'
Undefined symbols for architecture x86_64:
  "_EC_GFp_nistp224_method", referenced from:
      __cffi_f_EC_GFp_nistp224_method in _Cryptography_cffi_a269d620xd5c405b7.o
  "_EC_GFp_nistp256_method", referenced from:
      __cffi_f_EC_GFp_nistp256_method in _Cryptography_cffi_a269d620xd5c405b7.o
  "_EC_GFp_nistp521_method", referenced from:
      __cffi_f_EC_GFp_nistp521_method in _Cryptography_cffi_a269d620xd5c405b7.o
  "_EC_curve_nid2nist", referenced from:
      __cffi_f_EC_curve_nid2nist in _Cryptography_cffi_a269d620xd5c405b7.o
  "_SSL_CTX_set_alpn_protos", referenced from:
      __cffi_f_SSL_CTX_set_alpn_protos in _Cryptography_cffi_a269d620xd5c405b7.o
  "_SSL_CTX_set_alpn_select_cb", referenced from:
      __cffi_f_SSL_CTX_set_alpn_select_cb in _Cryptography_cffi_a269d620xd5c405b7.o
  "_SSL_get0_alpn_selected", referenced from:
      __cffi_f_SSL_get0_alpn_selected in _Cryptography_cffi_a269d620xd5c405b7.o
  "_SSL_set_alpn_protos", referenced from:
      __cffi_f_SSL_set_alpn_protos in _Cryptography_cffi_a269d620xd5c405b7.o
  "_X509_VERIFY_PARAM_set1_email", referenced from:
      __cffi_f_X509_VERIFY_PARAM_set1_email in _Cryptography_cffi_a269d620xd5c405b7.o
  "_X509_VERIFY_PARAM_set1_host", referenced from:
      __cffi_f_X509_VERIFY_PARAM_set1_host in _Cryptography_cffi_a269d620xd5c405b7.o
  "_X509_VERIFY_PARAM_set1_ip", referenced from:
      __cffi_f_X509_VERIFY_PARAM_set1_ip in _Cryptography_cffi_a269d620xd5c405b7.o
  "_X509_VERIFY_PARAM_set1_ip_asc", referenced from:
      __cffi_f_X509_VERIFY_PARAM_set1_ip_asc in _Cryptography_cffi_a269d620xd5c405b7.o
  "_X509_VERIFY_PARAM_set_hostflags", referenced from:
      __cffi_f_X509_VERIFY_PARAM_set_hostflags in _Cryptography_cffi_a269d620xd5c405b7.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: Setup script exited with error: command '/usr/bin/clang' failed with exit status 1
An error occurred when trying to install cryptography 0.9.3. Look above this message for any errors that were output by easy_install.
While:
  Installing django.
  Getting distribution for 'cryptography>=0.7'.
Error: Couldn't install: cryptography 0.9.3
我跑过:

brew install openssl
brew install pkg-config libffi
env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include"
pip install cffi
我注意到我的机器已经有一个旧版本的openssl,所以我创建了一个新版本的符号链接:

openssl version
OpenSSL 1.0.1f 6 Jan 2014
mv /sw/bin/openssl /sw/bin/openssl_OLD
ln -s /usr/local/Cellar/openssl/1.0.2d_1/bin/openssl /sw/bin/openssl
openssl version
OpenSSL 1.0.2d 9 Jul 2015
我还可以确认我有一台64位机器:

file /sw/lib/libffi.6.dylib
/sw/lib/libffi.6.dylib: Mach-O 64-bit dynamically linked shared library
运行依赖项为cryptography==0.7的同一脚本会导致相同的错误

我正在运行GCC4.2

到目前为止,我所做的任何尝试都无法改变我在django buildout中遇到的错误:(当我运行pip install cryptography时,它似乎安装得很干净,但此buildout脚本坚持安装本地副本


有人对我下一步应该尝试什么有什么建议吗?我已经没有主意了。

所以问题出在
brew安装openssl
1.0.2d版上

我切换到使用
端口安装openssl
和中所述的相同env标志 这意味着构建成功完成

但是,当尝试运行
/bin/django migrate
时,我遇到了另一个错误:

  raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/<user>/Sites/<site>/eggs/psycopg2-2.6-py2.7-macosx-10.8-x86_64.egg/psycopg2/_psycopg.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/lib/libpq.5.dylib
  Reason: image not found

原来问题出在
brew安装openssl
1.0.2d版上

我切换到使用
端口安装openssl
和中所述的相同env标志 这意味着构建成功完成

但是,当尝试运行
/bin/django migrate
时,我遇到了另一个错误:

  raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/<user>/Sites/<site>/eggs/psycopg2-2.6-py2.7-macosx-10.8-x86_64.egg/psycopg2/_psycopg.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/lib/libpq.5.dylib
  Reason: image not found