Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Learn to program with Minecraft
#1
I did everything write but the import of minecraft on python wont work. Did they update the code to import it. The book says,"from mcpi.minecraft import Minecraft" The error message is this:
Error:
Traceback (most recent call last): File "C:/Users/Sheep/OneDrive/Desktop/Ayden/Minecraft Python.py", line 1, in <module> from mcpi.minecraft import Minecraft ModuleNotFoundError: No module named 'mcpi'
Age Doesn't Matter, Your Passion Does
- Shreya Jain
Quote
#2
Quote:I did everything write but the import of minecraft on python wont work.
well, not quite, You need to install 'mcpi'
pip install mcpi
SheeppOSU likes this post
Quote
#3
It says install is invalid syntax
Age Doesn't Matter, Your Passion Does
- Shreya Jain
Quote
#4
I did everything write but the import of minecraft on python wont work. Did they update the code to import it. The book says,"from mcpi.minecraft import Minecraft". I also tried putting "pip install mcpi" on line 1. The error message is this:
Error:
Traceback (most recent call last): File "C:/Users/Sheep/OneDrive/Desktop/Ayden/Minecraft Python.py", line 1, in <module> from mcpi.minecraft import Minecraft ModuleNotFoundError: No module named 'mcpi'
Age Doesn't Matter, Your Passion Does
- Shreya Jain
Quote
#5
(Nov-12-2018, 03:23 PM)SheeppOSU Wrote: It says install is invalid syntax

Pip is a program, not python syntax. Run pip install mcpi from the command line, not from within an interactive python session (or a python script).
Quote
#6
I wrote it like this:
pip install mcpi
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
Age Doesn't Matter, Your Passion Does
- Shreya Jain
Quote
#7
Right. Don't do that.
Quote
#8
(Nov-12-2018, 10:00 PM)nilamo Wrote: Right. Don't do that.
How do I do it
Age Doesn't Matter, Your Passion Does
- Shreya Jain
Quote
#9
(Nov-12-2018, 11:11 PM)SheeppOSU Wrote: How do I do it
You do it from command line(cmd).
Look here how pip shall works and usage Python 3.6/3.7 and pip installation under Windows.
Quote
#10
follow this list verbatim:
  • open a terminal and bring up a command line (not python, and not in a file).
  • on windows, click start
  • in box at bottom type cmd
  • in the cmd window, type pip install mcpi
  • now import in your script. (remove the pip line)
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  how to draw terrain like minecraft in python using opengl with perlin noise value? hsunteik 0 2,765 Jan-21-2017, 11:45 AM
Last Post: hsunteik
  how to generate random 3d world (like minecraft) in python hsunteik 3 2,722 Jan-06-2017, 06:35 PM
Last Post: metulburr

Forum Jump:


Users browsing this thread: 1 Guest(s)