pygame安装问题(1) 'module' object has no attribute 'init'
来源:互联网 发布:拍大师登录网络超时 编辑:程序博客网 时间:2024/06/06 07:43
近期打算利用pygame库写一个小游戏,在下载pygame后用脚本运行pygame.init()语句时报错:
翻译下错误原因就是导入的pygame包中没有定义init()函数。
然而我从安装目录下发现的确存在__init__函数,而且在Sheel(IDLE编辑器)中直接运行pygame.init()并没有报错:
- >>> import pygame
- >>> pygame.init()
- (6, 0)
- >>> pygame
- <module 'pygame' from 'C:\Python27\lib\site-packages\pygame\__init__.pyc'>
pyc文件,是python编译后的字节码(bytecode)文件。只要你运行了py文件,python编译器就会自动生成一个对应的pyc字节码文件。这个pyc字节码文件,经过python解释器,会生成机器码运行。所以把这个.pyc文件名改掉就能正常导入包了。
阅读全文
0 0
- pygame安装问题(1) 'module' object has no attribute 'init'
- pygame安装问题(1) 'module' object has no attribute 'init'
- AttributeError: ‘module’ object has no attribute’ 问题
- AttributeError: 'module' object has no attribute 'post'问题
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- 问题AttributeError: ‘module’ object has no attribute ‘sub’
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- Centos安装GateOne问题AttributeError: 'module' object has no attribute 'enable_pretty_logging'解决方案
- ansible安装遇到"AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'"的问题
- AttributeError: 'module' object has no attribute 'getpass'
- 'module' object has no attribute 'basicConfig'
- AttributeError: 'module' object has no attribute 'Serial'
- 'module' object has no attribute 'rindex'
- AttributeError: 'module' object has no attribute(转)
- AttributeError: 'module' object has no attribute 'randint'
- AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
- Django: 'module' object has no attribute 'index'
- AttributeError: 'module' object has no attribute 'Serial'
- 数组重新分组将京东E卡排列在前面
- celery 配置手册
- NGUI文本列表TextList
- 展示系统应用和用户应用的列表
- 拖拽轨迹的回放
- pygame安装问题(1) 'module' object has no attribute 'init'
- 利用 tf.gradients 在 TensorFlow 中实现梯度下降
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- Unity 带参数启动
- pycharm常用快捷键
- win7系统安装 cygwin 的详细步骤
- Creating a Phong Specular type中对插图的疑问
- Struts2小结(2)
- 关于线程池的“惊群效应”