没有名为"pytmx"的模块,但安装了 pytmx



我正在通过YouTube教程系列学习一款基于Python-Pygame tile的游戏https://www.youtube.com/watch?v=QIXyj3WeyZM

我的代码与视频中的代码相同。(我已经检查了很多次错误。(

当我运行程序时,我得到了这个错误:

File "C:UsersPCDesktopletní hraTILE TUTORIALmain.py", line 6, in <module>
from sprites import *
File "C:UsersPCDesktopletní hraTILE TUTORIALsprites.py", line 3, in <module>
from tilemap import collide_hit_rect
File "C:UsersPCDesktopletní hraTILE TUTORIALtilemap.py", line 1, in <module>
import pytmx
ModuleNotFoundError: No module named 'pytmx'

它认为我缺少pytmx,但我像视频中那样用Terminalpip install pytmx安装了它。

我遇到了这个错误,所以我卸载了它,然后再次安装,但也出现了同样的错误。

我正在用Python 3.8运行我的代码,pytmx的安装路径是C:UsersPCAppDataLocalPackagesPythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0LocalCachelocal-packagesPython38site-packagespytmx

我卸载了pytmxpygamepython,然后重新安装。现在它识别pytmx,但我得到了这个巨大的TMX compression type: zstd is not supported错误。

TMX compression type: zstd is not supported.
Traceback (most recent call last):
File "C:UsersPCDesktopletní hraTILE TUTORIALmain.py", line 130, in <module>
g = Game()
File "C:UsersPCDesktopletní hraTILE TUTORIALmain.py", line 34, in __init__
self.load_data()
File "C:UsersPCDesktopletní hraTILE TUTORIALmain.py", line 41, in load_data
self.map = TiledMap(path.join(map_folder, "test64.tmx"))
File "C:UsersPCDesktopletní hraTILE TUTORIALtilemap.py", line 22, in __init__
tm = pytmx.load_pygame(filename, pixelalpha=True)
File "C:UsersPCAppDataLocalProgramsPythonPython37libsite-packagespytmxutil_pygame.py", line 141, in load_pygame
return pytmx.TiledMap(filename, *args, **kwargs)
File "C:UsersPCAppDataLocalProgramsPythonPython37libsite-packagespytmxpytmx.py", line 360, in __init__
self.parse_xml(ElementTree.parse(self.filename).getroot())
File "C:UsersPCAppDataLocalProgramsPythonPython37libsite-packagespytmxpytmx.py", line 391, in parse_xml
self.add_layer(TiledTileLayer(self, subnode))
File "C:UsersPCAppDataLocalProgramsPythonPython37libsite-packagespytmxpytmx.py", line 962, in __init__
self.parse_xml(node)
File "C:UsersPCAppDataLocalProgramsPythonPython37libsite-packagespytmxpytmx.py", line 1044, in parse_xml
raise Exception
Exception

相关内容

  • 没有找到相关文章

最新更新