简体   繁体   English

如何在Mac OS X上安装加密?

[英]How to install cryptography on Mac OS X?

My OS: Mac OS X El Capitan 我的操作系统:Mac OS X El Capitan

When I install cryptography like this: 当我安装这样的加密:

pip install cryptography==0.2.1

The error was: 错误是:

Collecting cryptography==0.2.1
  Using cached cryptography-0.2.1.tar.gz
    Complete output from command python setup.py egg_info:
    no previously-included directories found matching 'documentation/_build'
    zip_safe flag not set; analyzing archive contents...
    six: module references __path__

    Installed /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/six-1.10.0-py2.7.egg
    Searching for cffi>=0.8
    Reading https://pypi.python.org/simple/cffi/
    Best match: cffi 1.5.0
    Downloading https://pypi.python.org/packages/source/c/cffi/cffi-1.5.0.tar.gz#md5=dec8441e67880494ee881305059af656
    Processing cffi-1.5.0.tar.gz
    Writing /var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/easy_install-ZAtQYR/cffi-1.5.0/setup.cfg
    Running cffi-1.5.0/setup.py -q bdist_egg --dist-dir /var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/easy_install-ZAtQYR/cffi-1.5.0/egg-dist-tmp-Dl08xt
    creating /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg
    Extracting cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg to /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs

    Installed /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.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/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/easy_install-80l9Lo/pycparser-2.14/setup.cfg
    Running pycparser-2.14/setup.py -q bdist_egg --dist-dir /var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/easy_install-80l9Lo/pycparser-2.14/egg-dist-tmp-5dC3Ib
    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/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs

    Installed /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/pycparser-2.14-py2.7.egg
    running egg_info
    creating pip-egg-info/cryptography.egg-info
    writing requirements to pip-egg-info/cryptography.egg-info/requires.txt
    writing pip-egg-info/cryptography.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/cryptography.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/cryptography.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/cryptography.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    cryptography/hazmat/bindings/__pycache__/_cffi__xfdb41ad9xb4fc9075.c:369:5: error: conflicting types for 'ASN1_GENERALIZEDTIME_check'
    int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *);
        ^
    /usr/local/include/openssl/asn1.h:856:5: note: previous declaration is here
    int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
        ^
    1 error generated.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/setup.py", line 113, in <module>
        "build": cffi_build,
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 180, in run
        self.find_sources()
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 207, in find_sources
        mm.run()
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 291, in run
        self.add_defaults()
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 320, in add_defaults
        sdist.add_defaults(self)
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/sdist.py", line 118, in add_defaults
        build_py = self.get_finalized_command('build_py')
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/build_py.py", line 28, in finalize_options
        orig.build_py.finalize_options(self)
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/command/build_py.py", line 46, in finalize_options
        ('force', 'force'))
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/cmd.py", line 298, in set_undefined_options
        src_cmd_obj.ensure_finalized()
      File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/setup.py", line 55, in finalize_options
        OpenSSLBinding().ffi.verifier.get_extension(),
      File "cryptography/hazmat/bindings/openssl/binding.py", line 83, in __init__
        self._ensure_ffi_initialized()
      File "cryptography/hazmat/bindings/openssl/binding.py", line 99, in _ensure_ffi_initialized
        libraries)
      File "cryptography/hazmat/bindings/utils.py", line 72, in build_ffi
        ext_package="cryptography",
      File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg/cffi/api.py", line 433, in verify
        lib = self.verifier.load_library()
      File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg/cffi/verifier.py", line 110, in load_library
        self._compile_module()
      File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg/cffi/verifier.py", line 207, in _compile_module
        outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
      File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg/cffi/ffiplatform.py", line 29, in compile
        outputfilename = _build(tmpdir, ext, compiler_verbose)
      File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg/cffi/ffiplatform.py", line 62, in _build
        raise VerificationError('%s: %s' % (e.__class__.__name__, e))
    cffi.ffiplatform.VerificationError: CompileError: command 'clang' failed with exit status 1

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography

I am sure that I have upgrade the openssl to the newest version: 我确信我已将openssl升级到最新版本:

$ openssl version
OpenSSL 1.0.2f  28 Jan 2016

But I don't know how to fix it. 但我不知道如何解决它。 Even I checked the official documentation: 甚至我检查了官方文档:

https://cryptography.io/en/latest/installation/#building-cryptography-on-os-x https://cryptography.io/en/latest/installation/#building-cryptography-on-os-x

And follow that to do, the result was the same. 然后按照这样做,结果是一样的。

brew to the rescue: brew救援:

brew install openssl

then brew gives a hint: 然后brew提供了一个提示:

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries Apple不赞成使用OpenSSL来支持自己的TLS和加密库

Generally there are no consequences of this for you. 一般来说,这对您没有任何影响。 If you build your own software and it requires this formula, you'll need to add to your build variables: 如果您构建自己的软件并且需要此公式,则需要添加到构建变量中:

LDFLAGS:  -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig

So just export these env vars and rerun your favorite pip install (or better to avoid havoc in future add following to your ~/.bash_profile : 所以只需导出这些env vars并重新运行你最喜欢的pip安装(或者更好以避免在将来添加以下内容~/.bash_profile

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

This worked for me like a charm! 这对我来说就像一个魅力!

Trying to install the scrapy I need to install cryptography package on Mac OS El Capitan. 尝试安装scrapy我需要在Mac OS El Capitan上安装加密包。 As explained in Cryptography installation doc 正如Cryptography安装文档中所述

env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography env LDFLAGS =“ - L $(brew --prefix openssl)/ lib”CFLAGS =“ - I $(brew --prefix openssl)/ include”pip install cryptography

I had tried just about everything on this but still kept getting the following error: ... SWIG/_m2crypto_wrap.c:5258:12: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] return BIO_do_handshake(bio); 我曾尝试过关于此的所有内容,但仍然遇到以下错误:... SWIG / _m2crypto_wrap.c:5258:12:警告:隐式转换失去整数精度:'long'到'int'[-Wshorten-64- to-32]返回BIO_do_handshake(bio); ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~ /usr/local/opt/openssl/include/openssl/bio.h:502:34: note: expanded from macro 'BIO_do_handshake' # define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:7640:12: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] return BIO_ctrl(bio, BIO_C_SET_SSL, flag, (char *)ssl); ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~ / usr / local / opt / openssl / include /openssl / bio.h:502:34:注意:从宏扩展'BIO_do_handshake'#define BIO_do_handshake(b)BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ SWIG / _m2crypto_wrap.c:7640:12:警告:隐式转换失去整数精度:'long'到'int'[-Wshorten-64-to-32]返回BIO_ctrl (bio,BIO_C_SET_SSL,flag,(char *)ssl); ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:7699:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] err = ERR_get_error(); ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ SWIG / _m2crypto_wrap.c:7699:19:警告:隐式转换失去整数精度:'unsigned long'为'int'[-Wshorten-64-to-32] err = ERR_get_error(); ~ ^~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:7751:59: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] ms = ((start->tv_sec + (int)timeout) - tv.tv_sec) * 1000; 〜^ ~~~~~~~~~~~~~~ SWIG / _m2crypto_wrap.c:7751:59:警告:隐式转换失去整数精度:'long'到'int'[-Wshorten-64-to-32 ] ms =((start-> tv_sec +(int)timeout) - tv.tv_sec)* 1000; ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ SWIG/_m2crypto_wrap.c:7996:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] err = ERR_get_error(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~ SWIG / _m2crypto_wrap.c:7996:19:警告:隐式转换失去整数精度:'unsigned long'为'int'[-Wshorten-64-to-32] err = ERR_get_error(); ~ ^~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:8026:37: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32] r = SSL_write(ssl, buf.buf, buf.len); 〜^ ~~~~~~~~~~~~~~ SWIG / _m2crypto_wrap.c:8026:37:警告:隐式转换失去整数精度:'Py_ssize_t'(又名'long')到'int'[-Wshorten -64-to-32] r = SSL_write(ssl,buf.buf,buf.len); ~~~~~~~~~ ~~~~^~~ SWIG/_m2crypto_wrap.c:8069:37: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32] r = SSL_write(ssl, buf.buf, buf.len); ~~~~~~~~~~~~~ ^ ~~ SWIG / _m2crypto_wrap.c:8069:37:警告:隐式转换失去整数精度:'Py_ssize_t'(又名'long')到'int'[-Wshorten -64-to-32] r = SSL_write(ssl,buf.buf,buf.len); ~~~~~~~~~ ~~~~^~~ SWIG/_m2crypto_wrap.c:8087:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] err = ERR_get_error(); ~~~~~~~~~~~~~ ^ ~~ SWIG / _m2crypto_wrap.c:8087:19:警告:隐式转换失去整数精度:'unsigned long'到'int'[-Wshorten-64-to- 32] err = ERR_get_error(); ~ ^~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:8143:12: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] return SSL_CTX_set_session_cache_mode(ctx, mode); 〜^ ~~~~~~~~~~~~~~ SWIG / _m2crypto_wrap.c:8143:12:警告:隐式转换失去整数精度:'long'到'int'[-Wshorten-64-to-32 ]返回SSL_CTX_set_session_cache_mode(ctx,mode); ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/opt/openssl/include/openssl/ssl.h:2484:9: note: expanded from macro 'SSL_CTX_set_session_cache_mode' SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:8148:12: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] return SSL_CTX_get_session_cache_mode(ctx); ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ / usr / local / opt / openssl / include / openssl / ssl.h:2484:9:注意:从宏扩展'SSL_CTX_set_session_cache_mode'SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)^ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SWIG / _m2crypto_wrap.c:8148:12:警告:隐式转换失去整数精度:'long'到'int'[-Wshorten-64-to-32]返回SSL_CTX_get_session_cache_mode(ctx); ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/opt/openssl/include/openssl/ssl.h:2486:9: note: expanded from macro 'SSL_CTX_get_session_cache_mode' SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:8680:14: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] outlen = BIO_ctrl_pending(bio); ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ / usr / local / opt / openssl / include / openssl / ssl.h:2486:9:注意:从宏扩展'SSL_CTX_get_session_cache_mode'SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL)^ ~~~~~~~~~~~~~~~~~~~~转~~~~~~ :'size_t'(又名'unsigned long')到'int'[-Wshorten-64-to-32] outlen = BIO_ctrl_pending(bio); ~ ^~~~~~~~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:8742:14: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] outlen = BIO_ctrl_pending(bio); 〜^ ~~~~~~~~~~~~~~~~~~~~ SWIG / _m2crypto_wrap.c:8742:14:警告:隐式转换失去整数精度:'size_t'(又名'unsigned long')到'int'[-Wshorten-64-to-32] outlen = BIO_ctrl_pending(bio); ~ ^~~~~~~~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:22694:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32] arg4 = len; 〜^ ~~~~~~~~~~~~~~~~~~~~ SWIG / _m2crypto_wrap.c:22694:14:警告:隐式转换失去整数精度:'Py_ssize_t'(又名'long')到'int'[-Wshorten-64-to-32] arg4 = len; ~ ^~~ SWIG/_m2crypto_wrap.c:25282:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32] arg3 = len; 〜^ ~~ SWIG / _m2crypto_wrap.c:25282:14:警告:隐式转换失去整数精度:'Py_ssize_t'(又名'long')到'int'[-Wshorten-64-to-32] arg3 = len; ~ ^~~ 21 warnings generated. 生成了〜^ ~~ 21个警告。 SWIG/_m2crypto_wrap.c:2894:9: warning: variable 'res' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (PyType_Ready(tp) < 0) ^~~~~~~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:2918:10: note: uninitialized use occurs here return res; SWIG / _m2crypto_wrap.c:2894:9:警告:如果'if'条件为真,则使用变量'res'未初始化[-Wsometimes-uninitialized] if(PyType_Ready(tp)<0)^ ~~~~~~~~ ~~~~~~~~~~~ SWIG / _m2crypto_wrap.c:2918:10:注意:未初始化使用发生在这里返回res; ^~~ SWIG/_m2crypto_wrap.c:2894:5: note: remove the 'if' if its condition is always false if (PyType_Ready(tp) < 0) ^~~~~~~~~~~~~~~~~~~~~~~~~ SWIG/_m2crypto_wrap.c:2875:10: note: initialize the variable 'res' to silence this warning int res; ^ ~~ SWIG / _m2crypto_wrap.c:2894:5:注意:如果(PyType_Ready(tp)<0)^ ~~~~~~~~~~~~~~,如果条件总是为假,则删除'if' ~~~~~~~~~~ SWIG / _m2crypto_wrap.c:2875:10:注意:初始化变量'res'以使此警告无效; ^ = 0 1 warning generated. 生成^ = 0 1警告。 cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F。 -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include build/temp.macosx-10.13-intel-2.7/SWIG/_m2crypto_wrap.o -L/usr/lib -lssl -lcrypto -o build/lib.macosx-10.13-intel-2.7/M2Crypto/_m2crypto.so ld: warning: ignoring file /usr/local/opt/openssl/lib/libssl.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/opt/openssl/lib/libssl.dylib ld: warning: ignoring file /usr/local/opt/openssl/lib/libcrypto.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/opt/openssl/lib/libcrypto.dylib running install_lib creating /Library/Python/2.7/site-packages/M2Crypto error: could not create '/Library/Python/2.7/site-packages/M2Crypto': Permission denied -L / usr / local / opt / openssl / lib -I / usr / local / opt / openssl / include build / temp.macosx-10.13-intel-2.7 / SWIG / _m2crypto_wrap.o -L / usr / lib -lssl - lcrypto -o build / lib.macosx-10.13-intel-2.7 / M2Crypto / _m2crypto.so ld:警告:忽略文件/usr/local/opt/openssl/lib/libssl.dylib,文件是为x86_64构建的,不是正在链接的体系结构(i386):/ usr / local / opt / openssl / lib / libssl.dylib ld:警告:忽略文件/usr/local/opt/openssl/lib/libcrypto.dylib,文件是为x86_64构建的,而不是被链接的体系结构(i386):/usr/local/opt/openssl/lib/libcrypto.dylib正在运行install_lib创建/Library/Python/2.7/site-packages/M2Crypto错误:无法创建'/Library/Python/2.7/ site-packages / M2Crypto':权限被拒绝

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize; 命令“/ usr / bin / python -u -c”import setuptools,tokenize; file ='/private/var/folders/q5/qk1gf6z15kschmf5dwb3mqvh0000gn/T/pip-build-WyOs_y/M2crypto/setup.py';f=getattr(tokenize, 'open', open)( file );code=f.read().replace('\\r\\n', '\\n');f.close();exec(compile(code, file , 'exec'))" install --record /var/folders/q5/qk1gf6z15kschmf5dwb3mqvh0000gn/T/pip-tp6pQY-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/q5/qk1gf6z15kschmf5dwb3mqvh0000gn/T/pip-build-WyOs_y/M2crypto/ file ='/ private / var / folders / q5 / qk1gf6z15kschmf5dwb3mqvh0000gn / T / pip-build-WyOs_y / M2crypto / setup.py'; f = getattr(tokenize,'open',open)( file ); code = f.read ().replace('\\ r \\ n','\\ n'); f.close(); exec(compile(code, file ,'exec'))“install --record / var / folders / q5 / qk1gf6z15kschmf5dwb3mqvh0000gn /T/pip-tp6pQY-record/install-record.txt --single-version-external-managed --compile“在/ private / var / folders / q5 / qk1gf6z15kschmf5dwb3mqvh0000gn / T / pip-build-中失败,错误代码为1 WyOs_y / M2crypto /

I had the hardest time getting it working. 我最努力的工作。 The fix ended up being a simple chmod as sudo: sudo chmod 777 /Library/Python/2.7/site-packages/ 修复最终成为一个简单的chmod sudo:sudo chmod 777 /Library/Python/2.7/site-packages/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM