Python3.6树莓派3运行Telegram Bot时出现No module named future报错
Hey there, let's get that Telegram Bot up and running by fixing the missing future module error you're hitting. Here's exactly what you need to do:
Step 1: Install the future module
Since you're using Python 3.6 on Raspbian, you'll want to use the correct pip version to install the dependency. Open up your terminal and run one of these commands (depending on how your Pi's Python is set up):
- If
pip3is linked to Python 3.6 (most common case):sudo pip3 install future - If you need to explicitly target Python 3.6:
sudo python3.6 -m pip install future
Step 2: Verify the installation
To make sure the module installed correctly, run this quick test command in your terminal:
python3.6 -c "import future; print('Future module installed successfully!')"
If you see the success message, you're good to go—your original import code should now work without the error.
Quick note on your imports
The from __future__ import ... and from builtins import ... lines rely entirely on the future module to backport newer Python features to older versions like 3.6. That's why installing it resolves the missing module error.
If you run into any other missing module errors related to your Telegram Bot (like telegram itself), just install those the same way—for example:
pip3 install python-telegram-bot
内容的提问来源于stack exchange,提问作者PeppaPigKilla

