Mcpi minecraft python ошибка

Всем здравствуйте. Поднял сервер на майнкрафте на локалхосте, порт 4711. Замечательно работает, однако, есть проблемы с работой python3 на сервере.

from mcpi.minecraft import Minecraft
mc = Minecraft.create()

Так понимаю, что Minecraft.create() занимается непосредственно подключением к серверу, поскольку ошибка такова:

>>> Minecraft.create()
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.7/site-packages/mcpi/minecraft.py", line 205, in create return Minecraft(Connection(address, port)) File "/usr/lib/python3.7/site-packages/mcpi/connection.py", line 17, in __init__ self.socket.connect((address, port)) ConnectionRefusedError: [Errno 111] Connection refused

Пробовал также писать Minecraft.create(localhost, 4711), Minecraft.create(127.0.0.1, 4711) и еще несколько вариантов, но без толку.

Можете, пожалуйста, помочь и объяснить, в чём же проблема?

Операционная система — Manjaro Linux. Порт 4711 — открытый.

Posts: 480

Threads: 86

Joined: Feb 2018

Reputation:
21

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'

Posts: 11,651

Threads: 450

Joined: Sep 2016

Reputation:
445

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

Posts: 480

Threads: 86

Joined: Feb 2018

Reputation:
21

It says install is invalid syntax

Posts: 480

Threads: 86

Joined: Feb 2018

Reputation:
21

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'

Posts: 3,458

Threads: 101

Joined: Sep 2016

Reputation:
143

(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).

Posts: 480

Threads: 86

Joined: Feb 2018

Reputation:
21

I wrote it like this:

pip install mcpi
from mcpi.minecraft import Minecraft
mc = Minecraft.create()

Posts: 3,458

Threads: 101

Joined: Sep 2016

Reputation:
143

Posts: 480

Threads: 86

Joined: Feb 2018

Reputation:
21

(Nov-12-2018, 10:00 PM)nilamo Wrote: Right. Don’t do that.

How do I do it

Posts: 6,698

Threads: 120

Joined: Sep 2016

Reputation:
492

Nov-12-2018, 11:20 PM
(This post was last modified: Nov-12-2018, 11:20 PM by snippsat.)

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

Posts: 11,651

Threads: 450

Joined: Sep 2016

Reputation:
445

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)

Всем здравствуйте. Поднял сервер на майнкрафте на локалхосте, порт 4711. Замечательно работает, однако, есть проблемы с работой python3 на сервере.

from mcpi.minecraft import Minecraft
mc = Minecraft.create()

Так понимаю, что Minecraft.create() занимается непосредственно подключением к серверу, поскольку ошибка такова:

>>> Minecraft.create()
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.7/site-packages/mcpi/minecraft.py", line 205, in create return Minecraft(Connection(address, port)) File "/usr/lib/python3.7/site-packages/mcpi/connection.py", line 17, in __init__ self.socket.connect((address, port)) ConnectionRefusedError: [Errno 111] Connection refused

Пробовал также писать Minecraft.create(localhost, 4711), Minecraft.create(127.0.0.1, 4711) и еще несколько вариантов, но без толку.

Можете, пожалуйста, помочь и объяснить, в чём же проблема?

Операционная система — Manjaro Linux. Порт 4711 — открытый.

The worksheet instructs to use the Python3 menu item, which invokes IDLE3, which in turn invokes the python3.2.3 interpreter

The first step, to import minecraft from the mcpi module, then fails:
pi@RPi2B ~ $ python3
Python 3.2.3 (default, Mar 1 2013, 11:53:50)
[GCC 4.6.3] on linux2
Type «help», «copyright», «credits» or «license» for more information.

from mcpi import minecraft
Traceback (most recent call last):
File «», line 1, in
ImportError: No module named mcpi

It imports correctly using the Python/IDLE/python2.7.3 option. The sample screenshot in the worksheet was generated using python2.7.3

See this thread in the Raspberry Pi forums for an example of how confusing this can be: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=115897&p=796407#p790089

Mark Elliott

unread,

Jul 26, 2015, 4:35:38 PM7/26/15

to Adventures in Minecraft Forum

As a middle aged luddite hoping to inspire his son some help would be appreciated. Struggled with lesson one, appeared to run fine on python shell and bukkit but message wouldn’t show on Minecraft (I’m using the correct version) aware that something isn’t right I pushed on to lesson two; that too failed but I got this message and am wondering if it’s highlighting a more fundamental error to my set up: 

Original code:

import mcpi.minecraft as minecraft

mc = minecraft.Minecraft.create()

pos = mc.player.getTilePos()

print (pos.x)

print (pos.y)

print (pos.z)

Produced this result in the python shell:

Traceback (most recent call last):

  File «C:/Users/mark/Desktop/AdventuresInMinecraft/whereAmI.py.», line 1, in <module>

    import mcpi.minecraft as minecraft

ImportError: No module named mcpi.minecraft

Any guidance would be genuinely appreciated….

Martin O’Hanlon

unread,

Jul 27, 2015, 10:51:58 AM7/27/15

to Adventures in Minecraft Forum, markell…@gmail.com

Hi Mark,

Im sure we can help, in many respects Chapter 1 can be the most troublesome, getting everything setup for any programming task can be a challenge.

It sounds like you have successfully installed the StarterKit and Python and have managed to connect to your Bukkit server?  Great.

Have you saved your programs in the MyAdventures folder? 

The error you are getting is Python telling you that it cant find the minecraft api module which is in the mcpi folder in the MyAdventures folder.

If you have, can you see the mcpi folder in the MyAdventures folder? Could you perhaps send a screenshot which shows the contents of the MyAdventures folder and your program in it?

Let us know how you get on.

Martin

Adventures in Minecraft Forum

unread,

Jul 28, 2015, 8:54:58 PM7/28/15

to Adventures in Minecraft Forum, mar…@ohanlonweb.com

HI Martin, Thanks for the response, I’ve yeah successfully installed the StarterKit and Python and have managed to connect to your Bukkit server and yes I’ve saved the programmes to My Adventures Folder, as requested I’ve attached two screenshots of the relevant folders.

any guidance is appreciated!

thanks

Mark 

Martin O’Hanlon

unread,

Jul 28, 2015, 9:00:51 PM7/28/15

to Adventures in Minecraft Forum, adventures-in-…@googlegroups.com

Hi Mark,

Thanks for the info, its really useful.

So the whereami program is giving you an error because it cant find the mcpi folder. If you move it into the MyAdventures folder it should run. 

The starter kit is built so that everything you need to complete the projects is in the MyAdventures folder so you should save all your programs to there.

As to why HelloMinecraftWorld didnt work is a different issue as that is in the correct MyAdventures folders. The one thing which does come to mind is that when your program puts a message on the screen in Minecraft it only stays there for 10 seconds, so if your not quick switching to the Minecraft window after running your program its easy to miss it. Did any errors appear when you ran the program?

Let me us know how you get on.

Martin

Mark Elliott

unread,

Jul 30, 2015, 8:46:35 PM7/30/15

to Adventures in Minecraft Forum, mar…@ohanlonweb.com

Hi Martin, 

Thanks for the help, Lesson one for whatever reason isn’t working, however, lesson two did! so thanks for the help, On we go.

thanks again

Emlyn Soppa

unread,

Nov 2, 2017, 8:53:16 PM11/2/17

to Adventures in Minecraft Forum

Martin O’Hanlon

unread,

Jan 5, 2018, 11:07:07 PM1/5/18

to Adventures in Minecraft Forum

Hi Emlyn,

I just came across your post hiding in here. Can you elaborate? Do you receive a particular error? Are you struggling with the install? If its helpful there are videos available which talk you through the install process.

Let me know if I can help.

Martin

Jack Beefree

unread,

Feb 11, 2018, 6:55:24 AM2/11/18

to Adventures in Minecraft Forum

Hello Mark Elliott.

 It’s the same problem I had. but I discovered that mcpi does not appear in my / Documents / Minecraft Python / Minecraft Tools.

put the file I send in the above folder (I use Windows 10 and find this error today when reading your problems).

The mcpi file appear when I unzip (minecraftPythonAPI.zip)in the same folder / Documents / Minecraft Python / Minecraft Tools.

And voila the show must go on……  I think is too late this question but can help us.

 Good bye.

K3WL DERP

unread,

Apr 15, 2019, 3:12:30 AM4/15/19

to Adventures in Minecraft Forum

hello this is 2019 so this might be outdated but when I try to run «Install_API.bat» it opens cmd with an error ‘python’ is not recognized as an internal or external command, operable program or batch file. and I’m also on windows 10 so that might be the case

Andrew Kircher

unread,

Jun 24, 2019, 4:40:35 AM6/24/19

to Adventures in Minecraft Forum

I Right clicked on the «Install_API.bat» then went to edit and the changed the code to. 

py -3 -m pip install minecraftPythonAPI.zip
pause

Cory Eicher

unread,

Jan 13, 2020, 3:43:52 AM1/13/20

to Adventures in Minecraft Forum

We had the same error on Windows 10. We were able to fix by 1) installing PIP (https://pip.pypa.io/en/stable/installing/). Then 2) running this:

pip install mcpi

After this we were able to complete Adventure 1.

We’re using Python 3.4 FWIW.

-Cory

Понравилась статья? Поделить с друзьями:
  • Maxscript rollout handler exception ошибка при конвертации
  • Maxscript filein exception ошибка
  • Maxpro200 ошибка 109
  • Maxpro200 ошибка 040
  • Maxpro 200 ошибка 93