微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Macbook m1 无法安装 python-binance

如何解决Macbook m1 无法安装 python-binance

我正在尝试在我的 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)

解决方法

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。