虽然我安装了python-telegram-bot,但没有名为' telegram'

时间:2017-07-28 21:30:44

标签: python git python-2.7 telegram-bot python-telegram-bot

我安装了电报包。但是当我尝试运行简单的例子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'

4 个答案:

答案 0 :(得分:3)

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

cd python-telegram-bot
python setup.py install

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

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

pip install python-telegram-bot

答案 1 :(得分:0)

这个问题与smth一致

sys.path.append(os.path.join(os.path.abspath('.'), 'lib'))
bot_gae.py 中的

你必须指向真实的地方,你已经安装了python-telegram-bot。

就我而言,它是项目目录中的 ./ lib

答案 2 :(得分:0)

安装

pip install django-telegrambot

配置安装

settings.py

INSTALLED_APPS =( ... 'django_telegrambot', )

答案 3 :(得分:0)

就我而言,我是这样解决的。enter image description here

.call(d3.drag()
.on("start.interrupt", function() { timeline_svg.transition.duration(0);})