简体   繁体   English

Pythonpath问题-Cocos2d

[英]Pythonpath issue - Cocos2d

I'm trying to use a game library called Cocos2d in python. 我正在尝试在python中使用一个名为Cocos2d的游戏库。 However, I can't really import it. 但是,我不能真正导入它。 It's installed in one of python's lib directories, and when I import it, it's saying that it's not there. 它安装在python的lib目录之一中,当我导入它时,它就不存在了。 I know it has to do with pythonpath (provided in the IDE I'm using) but I'm not sure how to set it up. 我知道它与pythonpath有关(我正在使用的IDE中提供),但是我不确定如何设置它。 I've tried just adding the folder with cocos2d to the python path but it doesn't appear to work. 我试过只是将包含cocos2d的文件夹添加到python路径,但是它似乎不起作用。 The file's name is not cocos nor are there any files in the same directory with said name. 该文件的名称不是cocos,在同一目录中也没有任何具有该名称的文件。 Any suggestions? 有什么建议么?

Do you get an import error message ? 您收到导入错误消息吗?

I don't know how you installed it but here are the steps I just did and which are working here. 我不知道您是如何安装它的,但是这是我刚才做的步骤,并且在这里起作用。

  • Download cocos2d-0.4.0.zip from the official website 从官方网站下载cocos2d-0.4.0.zip
  • Extract it anywhere 提取到任何地方
  • Open a command-line in that folder 在该文件夹中打开命令行
  • type python setup.py install 输入python setup.py install

可可安装

It even automatically installs pyglet. 它甚至会自动安装pyglet。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM