[英]Python and different Operating Systems
I am about to start a personal project using python and I will be using it on both Linux(Fedora) and Windows(Vista), Although I might as well make it work on a mac while im at it. 我即将开始使用python的个人项目,我将在Linux(Fedora)和Windows(Vista)上使用它,虽然我不妨在它上面使用它。 I have found an API for the GUI that will work on all 3. The reason I am asking is because I have always heard of small differences that are easily avoided if you know about them before starting.
我找到了一个适用于所有3的GUI的API。我问的原因是因为我总是听说如果你在开始之前了解它们就很容易避免的小差异。 Does anyone have any tips or suggestions that fall along these lines?
有没有人有这些方面的任何提示或建议?
In general: 一般来说:
More specific stuff: 更具体的东西:
Some things I've noticed in my cross platform development in Python: 我在Python的跨平台开发中注意到的一些事情:
You should take care of the Python version you are developing against. 您应该处理您正在开发的Python版本。 Especially, on a Mac, the default version of Python installed with the OS, is rather old (of course, newer versions can be installed)
特别是在Mac上,随操作系统安装的Python的默认版本相当陈旧(当然,可以安装更新的版本)
Don't use the OS specific libraries 不要使用特定于操作系统的库
Take special care of 'special' UI elements, like taskbar icons (windows), ... 特别注意'特殊'UI元素,如任务栏图标(窗口),...
Use forward slashes when using paths, avoid C:/, /home/..., ... Use os.path to work with paths. 使用路径时使用正斜杠,避免C:/,/ home / ...,...使用os.path来处理路径。
Some filename problems: This.File and this.file are different files on Linux, but point to the same file on Windows. 一些文件名问题:This.File和this.file是Linux上的不同文件,但指向Windows上的同一文件。 Troublesome if you manage some file repository and access it from both platforms.
如果您管理一些文件存储库并从两个平台访问它,那就太麻烦了。 Less frequent related problem is that of names like NUL or LPT being files on Windows.
较不常见的相关问题是像NUL或LPT这样的名称是Windows上的文件。
Binary distribution code (if any) would likely use py2exe on Win, py2app on Mac and wouldn't be present on Linux. 二进制分发代码(如果有的话)可能会在Win上使用py2exe,在Mac上使用py2app并且不会出现在Linux上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.