Using a Kano computer kit to program in Python with Minecraft

364 views
Skip to first unread message

Kyle Silfer

unread,
Dec 16, 2017, 4:04:31 PM12/16/17
to Adventures in Minecraft Forum
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 package

Open a shell window and issue:

sudo apt-get install python3-setuptools

2. install the missing Python 3 Minecraft API package

Get it here:

https://github.com/py3minepi/py3minepi

Open up a shell window and unzip the archive you downloaded.

unzip py3minepi-master.zip

Install it.

cd py3minepi-master
sudo python3 setup.py install


3. Run Minecraft in a window

From the shell:

/usr/share/make-minecraft/minecraft-pi &

4. Run the right version of IDLE

From 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.

Reply all
Reply to author
Forward
0 new messages