在树莓派 3 上通过 pip 安装 web3 时出错

Posted

技术标签:

【中文标题】在树莓派 3 上通过 pip 安装 web3 时出错【英文标题】:Error when installing web3 via pip on raspberry pi 3 【发布时间】:2021-12-01 17:39:33 【问题描述】:

我刚刚开始使用新的 rasbpian os flash 并将 python 升级到 3.9.7。在我运行 'sudo pip install web3' 之前,一切都会检查并收到此错误:

pi@raspberrypi:~ $ sudo pip install web3
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 173, in _main
    status = self.run(options, args)
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 203, in wrapper
    return func(self, options, args)
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 266, in run
    session = self.get_default_session(options)
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 74, in get_default_session
    self._session = self.enter_context(self._build_session(options))
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 88, in _build_session
    session = PipSession(
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/network/session.py", line 289, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/network/session.py", line 132, in user_agent
    linux_distribution = distro.linux_distribution()  # type: ignore
  File "/usr/local/lib/python3.9/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/local/lib/python3.9/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution
    self.version(),
  File "/usr/local/lib/python3.9/site-packages/pip/_vendor/distro.py", line 741, in version
    self.lsb_release_attr('release'),
  File "/usr/local/lib/python3.9/site-packages/pip/_vendor/distro.py", line 903, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/local/lib/python3.9/site-packages/pip/_vendor/distro.py", line 556, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/local/lib/python3.9/site-packages/pip/_vendor/distro.py", line 1014, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/local/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

我觉得我的 python 安装可能有问题,但我什至不知道从哪里开始。

【问题讨论】:

【参考方案1】:

工具链中的某些东西,我不知道是什么,需要lsb_release Linux 系统命令来检查你的 Linux 版本(可能是检查库的兼容性)。

使用您的 Linux 分发工具安装此命令,它应该会安装。

【讨论】:

以上是关于在树莓派 3 上通过 pip 安装 web3 时出错的主要内容,如果未能解决你的问题,请参考以下文章

Theano 在树莓派上使用 Keras

树莓派学习 2. 开发环境搭建

树莓派无法安装 lxml pip 包

在树莓派上运行 vcpkg 时出现 VCPKG_FORCE_SYSTEM_BINARIES 错误

树莓派3B+安装virtualenv和virtualenvwrapper

使用 pip 安装程序安装 web3 时出现问题(cytoolz 错误)