0

我创建了一个机器人来与 Binance 交易 BTC,目前正在尝试设置我的 Raspberry Pi 3 B+。随着每个 pip install python-binance 我得到

  Using cached backports.zoneinfo-0.2.1.tar.gz (74 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: backports.zoneinfo
  Building wheel for backports.zoneinfo (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/ubuntu/test/venv/bin/python3 /tmp/tmp6c7k6imv build_wheel /tmp/tmpuge_0m5b
       cwd: /tmp/pip-install-cje139s6/backports.zoneinfo
  Complete output (39 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-aarch64-3.8
  creating build/lib.linux-aarch64-3.8/backports
  copying src/backports/__init__.py -> build/lib.linux-aarch64-3.8/backports
  creating build/lib.linux-aarch64-3.8/backports/zoneinfo
  copying src/backports/zoneinfo/_tzpath.py -> build/lib.linux-aarch64-3.8/backports/zoneinfo
  copying src/backports/zoneinfo/_common.py -> build/lib.linux-aarch64-3.8/backports/zoneinfo
  copying src/backports/zoneinfo/__init__.py -> build/lib.linux-aarch64-3.8/backports/zoneinfo
  copying src/backports/zoneinfo/_version.py -> build/lib.linux-aarch64-3.8/backports/zoneinfo
  copying src/backports/zoneinfo/_zoneinfo.py -> build/lib.linux-aarch64-3.8/backports/zoneinfo
  running egg_info
  writing src/backports.zoneinfo.egg-info/PKG-INFO
  writing dependency_links to src/backports.zoneinfo.egg-info/dependency_links.txt
  writing requirements to src/backports.zoneinfo.egg-info/requires.txt
  writing top-level names to src/backports.zoneinfo.egg-info/top_level.txt
  reading manifest file 'src/backports.zoneinfo.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching '*.png' under directory 'docs'
  warning: no files found matching '*.svg' under directory 'docs'
  no previously-included directories found matching 'docs/_build'
  no previously-included directories found matching 'docs/_output'
  adding license file 'LICENSE'
  adding license file 'licenses/LICENSE_APACHE'
  writing manifest file 'src/backports.zoneinfo.egg-info/SOURCES.txt'
  copying src/backports/zoneinfo/__init__.pyi -> build/lib.linux-aarch64-3.8/backports/zoneinfo
  copying src/backports/zoneinfo/py.typed -> build/lib.linux-aarch64-3.8/backports/zoneinfo
  running build_ext
  building 'backports.zoneinfo._czoneinfo' extension
  creating build/temp.linux-aarch64-3.8
  creating build/temp.linux-aarch64-3.8/lib
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/ubuntu/test/venv/include -I/usr/include/python3.8 -c lib/zoneinfo_module.c -o build/temp.linux-aarch64-3.8/lib/zoneinfo_module.o -std=c99
  lib/zoneinfo_module.c:1:10: fatal error: Python.h: No such file or directory
      1 | #include "Python.h"
        |          ^~~~~~~~~~
  compilation terminated.
  error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for backports.zoneinfo
Failed to build backports.zoneinfo
ERROR: Could not build wheels for backports.zoneinfo which use PEP 517 and cannot be installed directly

我尝试将 pip、wheel、setuptools 更新到最新版本,在我的台式计算机上运行相同的命令,它可以正常工作。我的树莓派的系统信息是:

  • 操作系统:Ubuntu 20.04.3 LTS
  • 蟒蛇:3.8.10
  • 点数:20.0.2
  • 车轮:0.37.0
  • 设置工具:58.0.4
4

3 回答 3

1

我跑了sudo apt install python3-dev,它奏效了!

于 2021-09-19T11:14:39.303 回答
0

我在 Raspberry Pi 上遇到了同样的问题。使用pip3 install python-binance代替pip install python-binance

于 2022-02-08T16:45:08.847 回答
0

我过去遇到过这个问题并发布过,但这是直接的解决方案。

细节

该问题主要与使用 IANA 从操作系统检索有关当前时间的数据有关,并且backports.zoneinfo是为 Windows 预先构建的,我们必须使用 Ruby 编译器或任何其他由错误指定的语言为 Linux 或 MacOS 构建包。

第一个解决方案

升级并重pipwheel安装。

pip install --upgrade pip wheel

pip install backports.zoneinfo

第二种解决方案

尝试安装名为tzdata. (为我的fastapi项目工作。)该包支持 Python 3,但它的自述文件未更新关于 Dev IDK 支持的 Python 2 为什么。

pip install tzdata

第三个解决方案

从您的系统包管理器安装Ruby Compiler并再次运行 pip 代码。鉴于以下是针对Ubuntu.

sudo apt-get install ruby-full

pip install backports.zoneinfo 
于 2022-02-21T13:19:18.107 回答