python pyinstaller 打包后 os路径获取不正确解决方案

gen_path = os.path.dirname(os.path.realpath(sys.argv[0])) #以上这句获取路径就正确了。 延伸阅读:html os.path.dirname(__file__)返回脚本的路径,可是须要注意一下几点:python 一、必须是实际存在的.py文件,若是在命令行执行,则会引起异常NameError: name '__file__' is not d
相关文章
相关标签/搜索