相关疑难解决方法(0)

pyinstaller 在程序内找不到文件路径

我创建了一个测试工具来检查是否有任何模块无法与 pyinstaller 一起使用,以便我可以在主程序上使用 pyinstaller 之前解决它们。

当我尝试与脚本中的文件路径交互时,pyinstaller 创建的程序似乎找不到我尝试硬编码到脚本中的路径,例如“Z:\mkb\crew\mark_conrad\pictures\psd_tool_test_files\test” .psd”。我决定使用简单的 os.path.exists() 来调试这个谜团,但没有运气。当我从 python 控制台运行调试程序时,它工作得很好,那么这里出了什么问题呢?

我如何生成exe:pyinstaller“Z:\ mkb \programing \ python \ util \ pyinstaller_library_tester.py”

Python版本:2.7.15 PyInstaller版本:3.3.1

领事输出:

Testing: Z:\mkb\crew\mark_conrad\pictures\psd_tool_test_files\test.psd
>>> This path does not exsist.
Path Results: False

Testing: Z:\\mkb\\crew\\mark_conrad\\pictures\\psd_tool_test_files\\test.psd
>>> This path does not exsist.
Path Results: False

Testing: Z:/mkb/crew/mark_conrad/pictures/psd_tool_test_files/test.psd
>>> This path does not exsist.
Path Results: False

Testing: Z://mkb//crew//mark_conrad//pictures//psd_tool_test_files//test.psd
>>> This path does not exsist.
Path Results: False
Run Code Online (Sandbox Code Playgroud)

调试程序代码:

def checkingPaths(path,btn):
    import os

    if os.path.exists(path):
        print '>>> Found a working …
Run Code Online (Sandbox Code Playgroud)

python pyinstaller python-2.7

1
推荐指数
1
解决办法
6049
查看次数

标签 统计

pyinstaller ×1

python ×1

python-2.7 ×1