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
相關文章
相關標籤/搜索