Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 setup.py 中指定我的脚本文件时,例如 "script": 'pythonturtle.py',我如何指定它在文件系统中的相对位置?就我而言,我需要进入两个文件夹,然后进入“src”文件夹,它就在那里。我如何以跨平台的方式编写它?
你怎么能说py2exe和跨平台呢?py2exe 仅适用于 Windows。
据我所知,您必须将安装文件与脚本保存在同一位置。或者,如果您不必这样做,那肯定是一个强大的约定。
您可以做的是定义一个 dist_dir 选项,以便您的程序构建在正确的位置。
setup( options = {"py2exe": {"dist_dir": os.path.join("..", "foo", "bar")}}, windows = ["pythonturtle.py"], )