简体   繁体   中英

cx_Freeze pygame error

i've recently started working with pygame and wanted to create an executable using cx_Freeze but i encounter an error every time i try to run my exe file.

Fatal Python error: initfsencoding: unable to load the file system codec
ImportError: invalid flags 1530097318 in 'encodings'

Current thread 0x000016f0 (most recent call first):

Here's my setup.py file:

import cx_Freeze


import os
os.environ['TCL_LIBRARY'] = "C:\\Python37-64\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Python37-64\\tcl\\tk8.6"

executables=[cx_Freeze.Executable('snk.py')]


cx_Freeze.setup(
    name='Snake',
    options={'build_exe':{'packages':['pygame'], 'include_files':['beep.wav', 'lost.wav', 'apple.png', 'snakehead2.png', 'apple2.png', 'tail.png', 'C:\\Windows\\Fonts\\MAGNETOB.TTF']}},
    description='Snake Game',
    executables=executables


    )

Can someone please help.

As I answered here .You are using python 3.7 . As far as I have tested , modules like pyinstaller and cx_freeze don't seem to be working in this version. Try uninstalling your python (don't forget to backup your files before), and installing python 3.6.3 or any other python 3 version except python 3.7 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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