不能在osx10.8上安装加密0.9.3。

时间:2021-03-23 18:24:36

I'm new to python and django. I'm struggling to install our company's development package locally since the latest release of django. Here's the message stack:

我是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

I've run:

我运行:

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

I noticed my machine already had an older version of openssl so I created a symlink to the new one:

我注意到我的机器已经有了一个旧版本的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

I can also confirm I have a 64bit machine:

我还可以确认我有一个64位的机器:

file /sw/lib/libffi.6.dylib
/sw/lib/libffi.6.dylib: Mach-O 64-bit dynamically linked shared library

Running the same script with a dependency of cryptography==0.7 results in the same error.

运行相同的脚本并依赖于加密==0.7,结果是相同的错误。

I'm running GCC 4.2

我运行GCC 4.2

Nothing I've tried so far changes the error I get in django buildout :( When I run pip install cryptography it seems to install cleanly but this buildout script insists on installing a local copy.

到目前为止,我还没有尝试修改django buildout中的错误(当我运行pip安装加密时,它似乎安装得很干净,但是这个构建脚本坚持安装本地副本)。

Does anyone have any suggestions on what I should try next? I'm running out of ideas.

对于我接下来应该尝试什么,有人有什么建议吗?我的想法没了。

1 个解决方案

#1


0  

So turns out the problem was with brew install openssl version 1.0.2d.

因此,问题是,brew安装了openssl版本1.0.2d。

I switched to using port install openssl and the same env flags as described in https://cryptography.io/en/latest/installation/ This meant buildout successfully completed.

我切换到使用端口安装openssl和与https://密码学中描述的相同的env标志。io/en/最新/安装/这意味着buildout成功完成。

However when trying to run ./bin/django migrate I got another error:

然而,当试图运行时,/bin/django迁移,我又犯了一个错误:

  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

This is because macports installs libssl to /opt/local/lib/. I fixed this with a cheeky symlink:

这是因为macports安装libssl到/opt/local/lib/。我用一种厚脸皮的符号来解决这个问题:

ln -s /opt/local/lib/ /usr/local/opt/openssl/lib

#1


0  

So turns out the problem was with brew install openssl version 1.0.2d.

因此,问题是,brew安装了openssl版本1.0.2d。

I switched to using port install openssl and the same env flags as described in https://cryptography.io/en/latest/installation/ This meant buildout successfully completed.

我切换到使用端口安装openssl和与https://密码学中描述的相同的env标志。io/en/最新/安装/这意味着buildout成功完成。

However when trying to run ./bin/django migrate I got another error:

然而,当试图运行时,/bin/django迁移,我又犯了一个错误:

  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

This is because macports installs libssl to /opt/local/lib/. I fixed this with a cheeky symlink:

这是因为macports安装libssl到/opt/local/lib/。我用一种厚脸皮的符号来解决这个问题:

ln -s /opt/local/lib/ /usr/local/opt/openssl/lib