使用 Python 3.4.4 的 Windows XP SP3 上的 PySimpleGUI 属性错误

PySimpleGUI Attribute Error on Windows XP SP3 with Python 3.4.4

提问人:Jjs22 提问时间:12/18/2022 更新时间:12/18/2022 访问量:80

问:

运行一个 Python 程序,该程序在 TkInter 之上使用 PySimpleGUI 接口。程序在 Windows 10 和 CentOS Linux 工作站上运行良好。不幸的是,在Windows XP Service Pack 3 PC上,在一个孤立的秘密实验室区域运行该程序,没有互联网,因此任何安装都以DVD形式引入。

Python 3.4.4 是我能找到的支持 Windows XP 的最新版本,它在 Tkinter 启动并运行的情况下也能很好地安装和运行。

电脑设置:

Windows XP 服务包 3

蟒蛇 3.4.4

PySimpleGUI 3.39.0

执行错误:

回溯(最近一次调用最后一次): 文件“PysharkLiveCapGUI.py”,第 9 行,在 <module> sg.theme('Topanga') AttributeError:“module”对象没有属性“theme”

PySimpleGUI EGG的路径:

键入“帮助”、“版权”、“版权”或“许可”以获取更多信息。

\>>> 将 PySimpleGUI 导入为 sg

\>>> 打印(新加坡)

<模块'PySimpleGUI'来自'C:\\Python34\\lib\\site-packages\\pysimplegui-3.39.0-py3.4.egg\\PySimpleGUI\\_init_.py'>

PySimpleGUI 安装结果:

C:\Python34\Downloads\dist\PySimpleGUI-3.39.0>python setup.py install
C:\Python34\lib\distutils\dist.py:260: UserWarning: Unknown distribution option:
 'long_description_content_type'
  warnings.warn(msg)
running install
running bdist_egg
running egg_info
writing top-level names to PySimpleGUI.egg-info\top_level.txt
writing PySimpleGUI.egg-info\PKG-INFO
writing dependency_links to PySimpleGUI.egg-info\dependency_links.txt
reading manifest file 'PySimpleGUI.egg-info\SOURCES.txt'
writing manifest file 'PySimpleGUI.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build\bdist.win32\egg
creating build\bdist.win32\egg\PySimpleGUI
copying build\lib\PySimpleGUI\PySimpleGUI.py -> build\bdist.win32\egg\PySimpleGU
I
copying build\lib\PySimpleGUI\__init__.py -> build\bdist.win32\egg\PySimpleGUI
byte-compiling build\bdist.win32\egg\PySimpleGUI\PySimpleGUI.py to PySimpleGUI.c
python-34.pyc
byte-compiling build\bdist.win32\egg\PySimpleGUI\__init__.py to __init__.cpython
-34.pyc
creating build\bdist.win32\egg\EGG-INFO
copying PySimpleGUI.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying PySimpleGUI.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying PySimpleGUI.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-I
NFO
copying PySimpleGUI.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist\PySimpleGUI-3.39.0-py3.4.egg' and adding 'build\bdist.win32\egg'
to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing PySimpleGUI-3.39.0-py3.4.egg
Removing c:\python34\lib\site-packages\PySimpleGUI-3.39.0-py3.4.egg
Copying PySimpleGUI-3.39.0-py3.4.egg to c:\python34\lib\site-packages
PySimpleGUI 3.39.0 is already the active version in easy-install.pth

Installed c:\python34\lib\site-packages\pysimplegui-3.39.0-py3.4.egg
Processing dependencies for PySimpleGUI==3.39.0
Finished processing dependencies for PySimpleGUI==3.39.0

问题?:

PySimpleGUI 安装似乎运行无错误。当我使用 7 Zip 检查 EGG 文件时,它看起来不错。最好的猜测是 Windows XP 不知道如何读取 EGG 文件,尽管它在 Python 执行中,理论上 Python 导入 EGG 文件没有问题。非常感谢对此问题的任何帮助。

谢谢

杰夫·斯特恩斯

蟒蛇 windows-xp pysimplegui

评论


答:

0赞 Jason Yang 12/18/2022 #1

程序在 Windows 10 和 CentOS Linux 工作站上运行良好。

如果你有这样的代码,你应该是错误的,你会得到异常,无论在 Windows 10、CentOS Linux 工作站上。sg.theme

PySimpleGUI 3.39.0

如果没有问题,函数从 4.14.0 PySimpleGUI 23-Dec-2019 发布。sg.theme

蟒蛇 3.4.4

“将您的 PySimpleGUI 升级到最新版本”可能不适用于此版本的 python。尝试使用旧方法。sg.change_look_and_feel

评论

0赞 Jjs22 12/18/2022
stackoverflow.com/users/11936135/jason-yang感谢您的反馈,将尝试change_look_and_feel。奇怪的是,相同的代码和安装在 CentOS 工作站上运行 3.39.0,运行在较新版本的 Python 3.6.8 中,这对这个问题应该无关紧要。非常感谢,会试一试!还需要安装 pyshark 和其他一些依赖项,这可能需要 GCC、GLIB 等,也必须跟踪这些旧版本的 XP。
0赞 Jason Yang 12/18/2022
PySimpleGUI 3.39.0 没有该功能,它应该不能在 CentOS 工作站上运行。sg.theme
0赞 Jjs22 12/19/2022
stackoverflow.com/users/11936135/jason-yang下载了PySimpleGUI的更新版本,好多了,谢谢你的帮助!!可能需要将旧版 PyShark 用于 XP,Python 3.4 不支持 Py-1.11.0。在XP上启动和运行是一个挑战,并不太令人怀疑。再次感谢!