Python Forum

Full Version: Learn to program with Minecraft
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
bonjour je voulais créer un programme de defense anti-joueur avec mes amis en serveur local et je voulais savoir
comment on peut choisir un joueur avec

pos = mc.player.getTilePos()

et si non, quelle commande permet de faire ça?
merci de votre reponse
(Nov-11-2018, 11:22 PM)SheeppOSU Wrote: [ -> ]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'

the answer is a lot simpler than you might think, i had the same problem and you just need to make sure your .py file is saved in the same folder that contains your "mcpi" folder
Hi there Larz60+
I have the same problem. I followed your advice but it didn't help. I'm no computer guru. I read in another forum that mcpi has to be in the folder below:
program files>python38>lib>site-packages
in site-packages folder I have an mcpi folder and an mcpi-1.2.0.dist-info folder
despite all these, I get this error in python shell:
no module named mcpi
your help is greatly appreciated.
From what you say it looks like it should be working just fine. I suppose it's possible that Python is looking in some other folder. If the mcpi folder is in the right place, then you should be able to import it just fine.

I used pip to install it, it somehow ended up in the wrong folder so I moved it to the right one, and then it was working. You can try opening up your Python installer, clicking customize -> next and then seeing what path it says, I think that's the one that it will look in.
(Aug-07-2019, 04:54 PM)bolospinga Wrote: [ -> ]bonjour je voulais créer un programme de defense anti-joueur avec mes amis en serveur local et je voulais savoir
comment on peut choisir un joueur avec

pos = mc.player.getTilePos()

et si non, quelle commande permet de faire ça?
merci de votre reponse

  1. Please start a new thread for your question
  2. Not everyone understands French, so translate and write in english
Translation in French :
  1. Veuillez commencer un nouveau fil pour votre question
  2. Tout le monde ne comprend pas le français, alors traduisez et écrivez en anglais
(Jun-04-2020, 06:18 AM)ArmansMom Wrote: [ -> ]Hi there Larz60+
I have the same problem. I followed your advice but it didn't help. I'm no computer guru. I read in another forum that mcpi has to be in the folder below:
program files>python38>lib>site-packages
in site-packages folder I have an mcpi folder and an mcpi-1.2.0.dist-info folder
despite all these, I get this error in python shell:
no module named mcpi
your help is greatly appreciated.
Please start a new thread when you have a problem, don't post it in a thread by another user
SheeppOSU:
when you use pip to install a package, never move it from where python installs it.
It's put there for a reason, and your code will find it if all was done properly, and probably won't find it if you move it.
Pages: 1 2