V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
inSpring
V2EX  ›  Python

pyinstaller + pyqt5 打出来的 windows 包,如果安装的路径有中文,就打不开吗?

  •  
  •   inSpring · 2022-06-01 09:46:02 +08:00 · 1701 次点击
    这是一个创建于 714 天前的主题,其中的信息可能已经有所发展或是发生改变。

    pyinstaller + pyqt5 + nsis 打出来的 windows 安装包,发给用户,如果用户的安装路径有中文,安装后,点击图标无法打开。

    V 友们有遇到这个问题吗?有啥解决办法吗

    2 条回复    2022-06-01 10:04:54 +08:00
    encro
        1
    encro  
       2022-06-01 10:02:19 +08:00
    首先排除 nsis 应该不会存在中文问题,因为一堆中文应用都是 nsis 打包的。安装成功后就和 nsis 没关系了。那么剩下来就是程序问题了:

    猜测 python 脚本 utf8 可能读取 windows 当前路径中文 gb 没有转码,导致路径错误,从而打不开。

    ----- 人脑 DEBUG
    bakaft
        2
    bakaft  
       2022-06-01 10:04:54 +08:00
    恰好刚碰到,可能是因为运行时解压的临时文件路径(解压到%TMP%或者%TEMP%) 存在中文(用户名字有中文)而导致的问题。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4356 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 05:23 · PVG 13:23 · LAX 22:23 · JFK 01:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.