简体   繁体   English

Cocos2d和Pyglet安装不起作用

[英]Cocos2d and Pyglet installation non-functional

After installing both by moving them into the Lib folder of my python installation, I get this error when trying to import cocos. 通过将它们都移动到我的python安装的Lib文件夹中进行安装后,尝试导入cocos时出现此错误。

Traceback (most recent call last):
  File "C:/Users/test/PycharmProjects/Testing/main.py", line 1, in <module>
    import cocos
  File "C:\Python34\lib\cocos\__init__.py", line 69, in <module>
    import os, pyglet
  File "C:\Python34\lib\pyglet\__init__.py", line 276
    print '[%d] %s%s %s' % (thread, indent, name, location)
                   ^
SyntaxError: invalid syntax

You are using Python 3, but attempting to use Python 2's print statement. 您正在使用Python 3,但尝试使用Python 2的print语句。 In Python 3 the print statement was changed to a print function. 在Python 3中,将print语句更改为print函数。 Try: 尝试:

print('[%d] %s%s %s' % (thread, indent, name, location))

You can also use a newer way to format strings in Python 3: 您还可以使用更新的方式在Python 3中设置字符串格式:

print('{:0d} {}{} {}'.format(thread, indent, name, location))

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

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