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

huangapple go评论72阅读模式
英文:

Installing pypi packages on termux using pip is not working

问题

在Termux上安装pyrogram或telethon时,您遇到了错误。以下是如何解决此问题并在Termux上正确安装软件包的方法:

  1. 确保您的Termux已经安装了Python和pip。您可以使用以下命令来安装它们:

    pkg install python
    pkg install python-pip
    
  2. 一旦确保Python和pip已安装,请尝试使用以下命令来安装telethon:

    pip install telethon
    
  3. 如果您仍然遇到问题,请确保您有足够的权限来安装软件包。您可以尝试使用su切换到超级用户权限,然后再次运行pip安装命令。

    su
    pip install telethon
    

请确保您的Termux环境正确配置,并且您有足够的权限来安装软件包。如果问题仍然存在,请提供更多错误详细信息以获取更多帮助。

英文:

while installing pyrogram or telethon on termux using pip I facing error. I'll provide error below.


~ $ 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.

how can we solve this problem and install packages correctly on termux

I have tried
pkg install python-pip
pip install pyrogram
pip3 install pyrogram
MATHLIB="m" pip install pyrogram
but all of them useless

答案1

得分: 0

你是否在虚拟环境(venv)中运行此安装,还是直接在操作系统的Python中运行?这个Python环境是在Linux或Mac上运行吗?因为错误消息中提到了一些文件管理权限问题。

英文:

Are you running this installation over a venv or directly in the OS python? This python env are running over Linux or Mac? Because inside of the error message are mentioned some permission issues to manage the files of this package.

答案2

得分: 0

Error appear because telethon was installed earlier, and files, which not removed, disturb to files with same name, which appearing during installation. Run in termux two commands:

pip uninstall telethon and...
pip install -U telethon

英文:

Error appear because telethon was installed earlier, and files, which not removed, disturb to files with same name,
which appearing during installation. Run in termux two commands:

pip uninstall telethon and... <br>
pip install -U telethon

答案3

得分: 0

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

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

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

幸运!

要退出venv只需键入deactivate
希望这对你有帮助。

英文:

I encountered this issue today and the first thing I got was your question!!

By trying to install it in Venv I could get it to work just fine...!

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

bingo

To get outta venv just type deactivate
hope this works for you.

huangapple
  • 本文由 发表于 2023年6月9日 03:48:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76435250.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定