簡體   English   中英

cx_Freeze + curses:“ NoneType”對象沒有屬性“ fileno”

[英]cx_Freeze + curses: 'NoneType' object has no attribute 'fileno'

我已經使用cx_Freeze實用工具從以下python腳本生成了一個exe文件:

from curses import wrapper

def main(stdscr):
    pass

wrapper(main)

但是當我運行它時,它給了我一個錯誤:

AttributeError: 'NoneType' object has no attribute 'fileno'

完整錯誤:

錯誤信息

問題是,當我從腳本中排除wrapper(main)時,exe可以正常工作。

我可以使用以下安裝腳本在Windows 7上使用python 3.6和cx_Freeze 5.1.1從您的curses_example.py python腳本中生成可運行的可執行文件:

from cx_Freeze import setup, Executable

executables = [Executable('curses_example.py')]

setup(name='curses_example',
      version='0.1',
      description='Sample cx_Freeze script',
      executables=executables)

為了使curses起作用,我首先需要使用以下命令安裝windows-curses

pip install windows-curses

遵循ImportError的提示:嘗試導入祝福時,沒有名為'_curses'的模塊

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM