I recently spent a couple hours hashing this out and thought I would find a place to post it for future Googlers.
The Kano is a popular Raspberry Pi-based computer kit that comes bundled with Minecraft. Earlier versions of the Kano OS included the mcpi Minecraft API and let you use Python code to interact with Minecraft, but the newer version (v3.14.0) does not.
Here's how to get that Python functionality on a newer (or updated) Kano:
1. install the missing Python 3 setuptools packageOpen a shell window and issue:
sudo apt-get install python3-setuptools2. install the missing Python 3 Minecraft API packageGet it here:
https://github.com/py3minepi/py3minepiOpen up a shell window and unzip the archive you downloaded.
unzip py3minepi-master.zipInstall it.
cd py3minepi-master
sudo python3 setup.py install3. Run Minecraft in a windowFrom the shell:
/usr/share/make-minecraft/minecraft-pi &4. Run the right version of IDLEFrom the shell:
idle3 &5. Use the correct import line in your programs:All code should start with:
from mcpi.minecraft import Minecraft
A couple of usability notes:
- You'll want to resize and move the Minecraft window so that it doesn't overlap your IDLE editor/shell window. It is always on top in the GUI and will hide anything that overlaps it.
- When making changes to your program in IDLE, be sure to Save before you Run the module. Otherwise, IDLE will pop up a window (almost certainly hidden by the Minecraft window) asking you to save before running.