Macbook m1 无法安装 python-binance

时间:2021-02-17 10:03:01

标签: python macos apple-silicon

我正在尝试在我的 MacBook M1 上安装 python-binance 库(学习 python 和加密)...... TA-Lib 有同样的问题,但通过 brew install 修复了这个问题 我不断得到

    renaatvandewiele@Renaats-MBP Pythontrade % sudo -H python3.9 -m pip install python-binance             Password: Collecting python-binance Using cached python_binance-0.7.9-py2.py3-none-any.whl (36 kB) Requirement already satisfied: requests in /opt/homebrew/lib/python3.9/site-packages (from python-binance) (2.25.1) Collecting service-identity   Using cached service_identity-18.1.0-py2.py3-none-any.whl (11 kB) Collecting cryptography   Using cached cryptography-3.4.6.tar.gz (546 kB)   Installing build dependencies ... done   Getting requirements to build wheel ... done
        Preparing wheel metadata ... error
        ERROR: Command errored out with exit status 1:
         command: /opt/homebrew/opt/python@3.9/bin/python3.9 /opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp9xr5jjee
             cwd: /private/tmp/pip-install-nvlbt5or/cryptography_372649a7a69d4e9ab469653b0c8c59e7
        Complete output (58 lines):

    
        =============================DEBUG ASSISTANCE=============================
        If you are seeing a compilation error please try the following steps to
        successfully install cryptography:
        1) Upgrade to the latest pip and try again. This will fix errors for most
           users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
        2) Read https://cryptography.io/en/latest/installation.html for specific
           instructions for your platform.
        3) Check our frequently asked questions for more information:
           https://cryptography.io/en/latest/faq.html
        4) Ensure you have a recent Rust toolchain installed:
           https://cryptography.io/en/latest/installation.html#rust
        5) If you are experiencing issues with Rust for *this release only* you may
           set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
        =============================DEBUG ASSISTANCE=============================
    

    Traceback (most recent call last):
      File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
        main()
      File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 161, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 145, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 71, in <module>
        setup(
      File "/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/opt/homebrew/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 432, in __init__
        _Distribution.__init__(self, {
      File "/opt/homebrew/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 292, in __init__
        self.finalize_options()
      File "/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 708, in finalize_options
        ep(self)
      File "/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 715, in _finalize_setup_keywords
        ep.load()(self, ep.name, value)
      File "/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 219, in cffi_modules
        add_cffi_module(dist, cffi_module)
      File "/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
        execfile(build_file_name, mod_vars)
      File "/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 25, in execfile
        exec(code, glob, glob)
      File "src/_cffi_src/build_openssl.py", line 76, in <module>
        ffi = build_ffi_for_binding(
      File "src/_cffi_src/utils.py", line 53, in build_ffi_for_binding
        ffi = build_ffi(
      File "src/_cffi_src/utils.py", line 73, in build_ffi
        ffi = FFI()
      File "/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/cffi/api.py", line 48, in __init__
        import _cffi_backend as backend
    ImportError: dlopen(/private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so, 2): no suitable image found.  Did find:
        /private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so: mach-o, but wrong architecture
        /private/tmp/pip-build-env-kijhr80e/overlay/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so: mach-o, but wrong architecture
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/fa/2d/2154d8cb773064570f48ec0b60258a4522490fcb115a6c7c9423482ca993/cryptography-3.4.6.tar.gz#sha256=2d32223e5b0ee02943f32b19245b61a62db83a882f0e76cc564e1cec60d48f87 (from https://pypi.org/simple/cryptography/) (requires-python:>=3.6). Command errored out with exit status 1: /opt/homebrew/opt/python@3.9/bin/python3.9 /opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp9xr5jjee Check the logs for full command output.
  Using cached cryptography-3.4.5.tar.gz (546 kB)

1 个答案:

答案 0 :(得分:0)

密码学目前不提供 arm64 macOS 轮(由于没有可用的 CI)。要成功安装它,您需要按照此处的说明进行操作:https://cryptography.io/en/latest/installation.html#building-cryptography-on-macos