1

I've been following the Python3 guide on roguebasin (http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,_using_python3%2Blibtcod,_part_0) and have gotten stuck during the libtcod installation. I've followed the guide completely and when it comes to the validating libtcod installation, when running the command

python -c "import libtcod"

I get:

(venv:libtcod-build|2.7.13) bash-3.2$ python -c "import libtcod"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named libtcod

I'm not sure what I'm doing wrong, or if I've missed any steps. Any ideas on how I can validate that libtcod is installed so I can move on to the next steps of this guide?

Thanks

EDIT Added in link of the guide I am following

  • 1
    It would help to link to exactly which guide you're following. I went to roguebasin and did a quick wiki search for `libtcod` and I found a page about the Doryen library and another page that didn't even mention `libtcod`, and I don't want to put any more time into searching. – abarnert Mar 11 '18 at 21:13
  • I've added in the link, but I was following the guide here: http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,_using_python3%2Blibtcod,_part_0 – masato.takaha Mar 11 '18 at 21:33
  • OK, much better. – abarnert Mar 11 '18 at 21:35
  • I notice that `libtcod` has a Homebrew package, which I'll bet would be easier, unless you need nightly versions of the library or something. – abarnert Mar 11 '18 at 21:42
  • Also, the guide seems to be wrong. Manually installing the C `dylib` to `/usr/local/lib` _shouldn't_ make `import libtcod` work—the error you're seeing is exactly what I'd expect there. So, I could probably help you get all this stuff installed by ignoring this guide, but that may just mean you're stuck in the next place, where the guide expects you to have done things in a certain way that I didn't do. You may be better off asking on the Roguebasin wiki community, or contacting whoever wrote the guide. – abarnert Mar 11 '18 at 21:47
  • Thank you for all the feedback @abarnert. I really appreciate you looking in to this. I did try installing using homebrew to no avail... I saw a guide using another library that wasn't libtcod, and I figured I would try that since installing the library was much more straightforward. – masato.takaha Mar 11 '18 at 22:07
  • Since I got a bit curious… I installed `libtcod` out of Homebrew, then pip-installed a different wrapper that uses cffi instead of ctypes that happened to be on PyPI, and that seemed to work (although I didn't test any farther than `import`). But as I said, I'm guessing that'll just run you into different problems in a later stage of the tutorial; you really need to talk to the people behind that tutorial. – abarnert Mar 11 '18 at 22:30
  • The guide says `python -c "import tcod"`, not `libtcod`. Have you tried this yet? – keepitwiel Jul 06 '18 at 11:23

0 Answers0