gpt4 book ai didi

python - 虽然我安装了 python-telegram-bot,但没有名为 'telegram' 的模块的错误

转载 作者:行者123 更新时间:2023-11-28 22:25:41 27 4
gpt4 key购买 nike

我安装了电报包。但是当我尝试运行简单示例 echobot.py 时,出现错误:

Traceback (most recent call last):
File "echobot.py", line 8, in <module>
import telegram ImportError: No module named 'telegram'

谁能帮帮我?

我使用 git 安装:

$ git clone https://github.com/python-telegram-bot/python-telegram-bot

在此之后:

$ python -i
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import telegram

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'telegram'

最佳答案

您没有安装它。你只是在下载它。
运行这些:

cd python-telegram-bot
python setup.py install

(在 GitHub 页面的自述文件中说明)

或者,您可以使用 pip。它更易于使用。

pip install python-telegram-bot

关于python - 虽然我安装了 python-telegram-bot,但没有名为 'telegram' 的模块的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45382698/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com