使用 pip 在 termux 上安装 pypi 包不起作用

问题描述 投票:0回答:3

使用 pip 在 termux 上安装 Pyrogram 或 telethon 时,我遇到错误。我将在下面提供错误。

~ $ pip install telethon
Collecting telethon                                       Downloading Telethon-1.28.5-py3-none-any.whl (600 kB)
     ━━━━━━━━━━━━━━ 600.9/600.9   284.4 kB/s eta 0:00:00
                    kB
Collecting pyaes (from telethon)
  Downloading pyaes-1.6.1.tar.gz (28 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done            Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error: [('/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info/PKG-INFO', '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/PKG-INFO', "[Errno 13] Permission denied: '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/PKG-INFO'"), ('/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info/dependency_links.txt', '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/dependency_links.txt', "[Errno 13] Permission denied: '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/dependency_links.txt'"), ('/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info/top_level.txt', '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/top_level.txt', "[Errno 13] Permission denied: '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/top_level.txt'"), ('/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info/SOURCES.txt', '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/SOURCES.txt', "[Errno 13] Permission denied: '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/SOURCES.txt'"), ('/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info', '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__', "[Errno 13] Permission denied: '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__'")]
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

我们如何解决这个问题并在 termux 上正确安装软件包

我已经尝试过了

pkg install python-pip
pip install pyrogram
pip3 install pyrogram
MATHLIB="m" pip install pyrogram

但全都没用

python pip package pypi termux
3个回答
0
投票

我今天遇到这个问题,我收到的第一件事就是你的问题!!

通过尝试在 Venv 中安装它,我可以让它正常工作......!

mkdir newDir; cd newDir;
python3 -m venv venv
. venv/bin/activate
pip install -U pyrogram
pip install -U telethon

宾果游戏

要退出

venv
,只需输入
deactivate
希望这对你有用。


0
投票

您是通过 venv 还是直接在操作系统 python 中运行此安装?这个 python 环境在 Linux 或 Mac 上运行?因为错误消息里面提到了管理这个包的文件的一些权限问题。


0
投票

出现错误是因为

telethon
安装较早,未删除的文件干扰了同名文件, 安装过程中出现的。在
termux
中运行两个命令:

pip uninstall telethon
和...
pip install -U telethon

© www.soinside.com 2019 - 2024. All rights reserved.