没有模块命名为future

时间:2018-03-18 23:30:00

标签: python-3.x raspbian

我在python中运行一个电报机器人,我在raspbian(pi3)上使用python3.6

以下是我的导入:

from __future__ import (absolute_import, division,
                    print_function, unicode_literals)
from builtins import (
    bytes, dict, int, list, object, range, str,
    ascii, chr, hex, input, next, oct, open,
    pow, round, super,
    filter, map, zip)
from uuid import uuid4

import re
import telegram

from telegram.utils.helpers import escape_markdown

from telegram import InlineQueryResultArticle, ParseMode, \
    InputTextMessageContent
from telegram.ext import Updater, InlineQueryHandler, CommandHandler
import logging
import random
import telepot
import unicodedata
import json
import requests
import bs4
from bs4 import BeautifulSoup

当我尝试使用sudo python3 bot.py运行我的机器人时,我得到

ImportError: No module named 'future'

我已经搜索并找到了很多答案,但没有一个对我有用,例如pip install futurepip3 install future模块确实在我的lib中显示python 3.6 future in lib

知道为什么它仍然说No module named future? ?

6 个答案:

答案 0 :(得分:8)

我使用别人编写的Python代码遇到了类似的问题。参见http://python-future.org/。 future是一个有助于在Python 2和3之间转换的模块。对我来说,安装pip3 install future

答案 1 :(得分:2)

这些都不适合我,尽管卸载了模块,然后用 pip3 install future 重新安装,但我不断收到错误消息(尝试运行 ardupilot 的 sim_vehicle.py --console --map 以防万一)

答案 2 :(得分:1)

我尝试安装,重新安装,easy_install和conda安装,但没有任何帮助。我终于能够通过将来运行升级来导入我的软件包。

pip install -U future 

这解决了我的问题。

答案 3 :(得分:0)

我遇到了类似的问题,使用easy_install future

解决了

答案 4 :(得分:0)

我遇到了类似的问题,使用conda install future

解决了

答案 5 :(得分:0)

我知道这是一个老问题,但如果有人需要的话。这发生在我尝试为 ArduPilot 构建测试时。

我遇到了类似的问题,您一直使用的 pip 是针对 python3 的。所以你需要为python2.7安装pip。你可以使用 curl 来做到这一点

apt-get install curl
curl https://bootstrap.pypa.io/2.7/get-pip.py -o get-pip.py
python get-pip.py

然后就可以运行了

pip install future

安装未来。