如何将python-telegram-bot成功安装到Termux? - python

我有个问题。我做了一个简单的网络抓取电报机器人,希望它能在我的旧手机上运行。但是,我无法通过pip安装python-telegram-bot。我收到此奇怪的错误消息。有谁知道我该如何解决这个问题?谢谢

> $ pip install python-telegram-bot Collecting python-telegram-bot  
> Using cached
> https://files.pythonhosted.org/packages/84/6c/47932a4041ee76650ad1f45a80e1422077e1e99c08a4d7a61cfbe5393d41/python_telegram_bot-11.1.0-py2.py3-none-any.whl
> Collecting future>=0.16.0 (from python-telegram-bot)   Using cached
> https://files.pythonhosted.org/packages/90/52/e20466b85000a181e1e144fd8305caf2cf475e2f9674e797b222f8105f5f/future-0.17.1.tar.gz
> Collecting certifi (from python-telegram-bot)   Using cached
> https://files.pythonhosted.org/packages/56/9d/1d02dd80bc4cd955f98980f28c5ee2200e1209292d5f9e9cc8d030d18655/certifi-2018.10.15-py2.py3-none-any.whl
> Collecting cryptography (from python-telegram-bot)   Using cached
> https://files.pythonhosted.org/packages/f3/39/d3904df7c56f8654691c4ae1bdb270c1c9220d6da79bd3b1fbad91afd0e1/cryptography-2.4.2.tar.gz
> Installing build dependencies ... error   Complete output from command
> /data/data/com.termux/files/usr/bin/python -m pip install
> --ignore-installed --no-user --prefix /data/data/com.termux/files/usr/tmp/pip-build-env-cvyz6a4p
> --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=18.5 wheel "cffi>=1.7,!=1.11.3;
> python_implementation != 'PyPy'":   Collecting setuptools>=18.5
>     Using cached https://files.pythonhosted.org/packages/e7/16/da8cb8046149d50940c6110310983abb359bbb8cbc3539e6bef95c29428a/setuptools-40.6.2-py2.py3-none-any.whl
> Collecting wheel
>     Using cached https://files.pythonhosted.org/packages/ff/47/1dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-none-any.whl
> Collecting cffi!=1.11.3,>=1.7
>     Using cached https://files.pythonhosted.org/packages/e7/a7/4cd50e57cc6f436f1cc3a7e8fa700ff9b8b4d471620629074913e3735fb2/cffi-1.11.5.tar.gz
>       Complete output from command python setup.py egg_info:
> 
>           No working compiler found, or bogus compiler options passed to
>           the compiler from Python's standard "distutils" module.  See
>           the error messages above.  Likely, the problem is not related
>           to CFFI but generic to the setup.py of any Python package that
>           tries to compile C code.  (Hints: on OS/X 10.8, for errors about
>           -mno-fused-madd see http://stackoverflow.com/questions/22313407/
>           Otherwise, see https://wiki.python.org/moin/CompLangPython or
>           the IRC channel #python on irc.freenode.net.)
> 
>       ----------------------------------------   Command "python setup.py egg_info" failed with error code 1 in
> /data/data/com.termux/files/usr/tmp/pip-install-kqmk4olx/cffi/
> 
>   ---------------------------------------- Command
> "/data/data/com.termux/files/usr/bin/python -m pip install
> --ignore-installed --no-user --prefix /data/data/com.termux/files/usr/tmp/pip-build-env-cvyz6a4p
> --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=18.5 wheel "cffi>=1.7,!=1.11.3;
> python_implementation != 'PyPy'"" failed with error code 1 in None $

参考方案

您必须具有Termux的开发工具链(包括编译器)。默认情况下,您可以install clang:

 pkg install clang python-dev

您也可以尝试gcc,请参见

https://android.stackexchange.com/a/186223

https://wiki.termux.com/wiki/Package_Management#Community_repositories

如何将Python 3.6安装移动到其他目录? - python

我已经在Windows中安装了Python 3.6.2 Windowsc:\users\username\AppData\Local\programs\Python\Python36(因为这是(完全愚蠢的)默认值。我已将其手动移至c:\但是,对Python 3.6.3的更新仍安装在原始目标上。我该如何更改(不卸载(也将卸载所有软件包))? 参考方案 我不确定…

Python pytz时区函数返回的时区为9分钟 - python

由于某些原因,我无法从以下代码中找出原因:>>> from pytz import timezone >>> timezone('America/Chicago') 我得到:<DstTzInfo 'America/Chicago' LMT-1 day, 18:09:00 STD…

Python Pandas导出数据 - python

我正在使用python pandas处理一些数据。我已使用以下代码将数据导出到excel文件。writer = pd.ExcelWriter('Data.xlsx'); wrong_data.to_excel(writer,"Names which are wrong", index = False); writer.…

Python sqlite3数据库已锁定 - python

我在Windows上使用Python 3和sqlite3。我正在开发一个使用数据库存储联系人的小型应用程序。我注意到,如果应用程序被强制关闭(通过错误或通过任务管理器结束),则会收到sqlite3错误(sqlite3.OperationalError:数据库已锁定)。我想这是因为在应用程序关闭之前,我没有正确关闭数据库连接。我已经试过了: connectio…

在Mac上的终端中停止python - python

在Mac上的终端中使用python,键入ctrl-z 将停止python,但不退出它,给出如下输出:>>> [34]+ Stopped python 如您所见,我已经停止了34个python调用。虽然我可以用>>> exit() 退出python,问题是:是否有一个快捷键可以真正在终端中退出(而不只是停止)python?而…