Comments (8)
报错发生的地方是类型注解不受支持. 😢
tuple[str, str]
这个写法自 Python 3.9 开始被引入 (见官方的 新特性说明), 所以 Python 3.8 抛出了错误. 我自己测试了一下也有这个报错.
我会在下个版本尽快修复所有类型注解的问题. 在此之前, 麻烦你使用 Python 3.9 进行打包工作.
另注: Windows 7 不支持安装 Python 3.9 及以上的版本. 现阶段可能无法满足你的需求.
from pyportable-installer.
好 的,感谢支持!
from pyportable-installer.
该问题已得到解决. 这次的修复改动量不大, 只涉及其中一个依赖库的更新. 请运行以下命令:
pip install -U lk-logger
将 lk-logger 升级到 5.0.5 版本后, 不需要改动其他库.
现在重新执行 python -m pyportable_installer -h
应当运行正常:
from pyportable-installer.
我用系统自带的cmd或者power shell这两种终端颜色代码未被正常打印,之前有遇到过win系统下应先执行以下代码才能显示颜色
import os
os.system('')
另外有个问题提示 importing cipher
失败,我用pip安装cipher后还是有同样的问题
PS D:\dec> python .\build.py
�[14t�[1m�[35m[pyportable_installer]�[0m�[0m�[1m�[34m/path_model.py�[0m�[0m�[90m:�[0m�[0m�[1m�[34m9�[0m�[0m �[90m >> �[0m�[0m�[35mmodule�[0m�[0m�[90m >> �[0m�[0m�[90m[DEBUG] �[0m�[0m�[90mASSETS_ENTRY = PACKAGE�[0m�[0m
�[1m�[35m[pyportable_installer]�[0m�[0m�[1m�[34m/path_model.py�[0m�[0m�[90m:�[0m�[0m�[1m�[34m37�[0m�[0m �[90m >> �[0m�[0m�[32mPyPortablePathModel() �[0m�[0m�[90m >> �[0m�[0m�[90m[DEBUG] �[0m�[0m�[90mcur_root = C:/Users/123/AppData/Local/Programs/Python/Python38-32/lib/site-packages/pyportable_installer�[0m�[0m
�[1m�[35m[pyportable_installer]�[0m�[0m�[1m�[34m/main_flow/step1/main.py�[0m�[0m�[90m:�[0m�[0m�[1m�[34m19�[0m�[0m �[90m >> �[0m�[0m�[32mmain()�[0m�[0m�[90m >> �[0m�[0mpyproj_dir = D:/dec
Traceback (most recent call last):
File ".\build.py", line 4, in <module>
full_build('./pyproject.json')
File "C:\Users\123\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyportable_installer\main.py", line 56, in full_build
return main(file, additional_conf or {})
File "C:\Users\123\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyportable_installer\main.py", line 113, in main
conf = main_flow.main(pyproj_file, additional_conf)
File "C:\Users\123\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyportable_installer\main_flow\__init__.py", line 19, in main
conf = step1(pyproj_file, additional_conf)
File "C:\Users\123\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyportable_installer\main_flow\step1\main.py", line 24, in main
init_key_params(conf, pyproj_file=pyproj_file, pyproj_dir=pyproj_dir)
File "C:\Users\123\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyportable_installer\main_flow\step1\init_key_params.py", line 20, in init_key_params
_init_pyportable_runtime_package()
File "C:\Users\123\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyportable_installer\main_flow\step1\init_key_params.py", line 104, in _init_pyportable_runtime_package
import pyportable_runtime # noqa
File "C:/Users/123/AppData/Local/Programs/Python/Python38-32/lib/site-packages/pyportable_installer/compilers/lib/pyportable_runtime_py38\pyportable_runtime\__init__.py", line 24, in <module>
from .cipher import decrypt # noqa
ImportError: DLL load failed while importing cipher: %1 不是有效的 Win32 应用程序。
from pyportable-installer.
颜色乱码的问题:
在 windows terminal 或 pycharm 控制台中可以正常显示.
但是 cmd 和 powershell 中的乱码目前无法解决. 我需要投入更多时间来升级 lk-logger 库.
ImportError 问题:
它由 pyproject.json : build : compiler : mode : pyportable_crypto
加密选项引起.
pyportable_crypto 当前仅支持 64 位的 python 3.8, 3.9, 3.10 版本. 从截图来看你正在使用的是 32 位的 python 3.8, 所以抛出此错误.
pyportable-installer 在兼容性测试上还存在许多不足. 请等待后续的进展, 感谢你的反馈.
from pyportable-installer.
mode改成pyc后还是一样的错误提示
- 想问一下本工具产生的exe文件体积与pyinstaller相比差别有多大呢
- 看到readme文档中连
tkinter
都需要特殊处理才能参与编译,想问问本工具对于pyside2这种第三方库还能支持吗
from pyportable-installer.
想问一下本工具产生的 exe 文件体积与 pyinstaller 相比差别有多大呢
本工具产生的体积呢受 embedded python 解释器和 venv 影响较大.
- 使用本工具测试打包 ~/examples/eg_01_hello_world, 输出体积为 16mb.
- 打包 ~/examples/eg_02_pyportable_installer_bootstrap, 输出体积为 20mb.
体积构成:
- 嵌入式 python 解释器 (不包含 tkinter) (15mb)
- venv (取决于依赖的第三方库的体积)
- 加密后的代码 (与源代码同等量级, 一般在 10kb ~ 10mb 之间)
嵌入式 python 解释器 (15mb) 不包含 tkinter 库, 如果额外加入 tkinter, 会增加 13mb 空间.
以上数据受 python 解释器版本的影响会有一定出入.
如果 venv 中加入 pyside2 这种体积较大的库, 会占据 150mb ~ 200mb 的空间. 这些体积最终累积到打包结果中, 仍然是可观的.
看到 readme 文档中连 tkinter 都需要特殊处理才能参与编译, 想问问本工具对于 pyside2 这种第三方库还能支持吗
tkinter 的处理策略与 python 解释器有关. 这方面可参考 这个回答 做进一步了解.
pyside2 我自己尝试打包成功过. 将它加入到 venv 后, 不需要额外处理. 但是最终的打包体积会在 180mb 以上, 其中 pyside2 自身的体积将占据较大比重.
from pyportable-installer.
引入pyside2后打包体积比pyinstaller还要大啊,我有个界面比较简单的pyside2项目,用pyinstaller打包单个exe文件大概36M
from pyportable-installer.
Related Issues (12)
- pip install 报找不到模块 HOT 4
- ImportError: cannot import name 'currdir' from 'lk_utils.filesniff HOT 1
- 配置无控制台打包,移动后仍有控制台 HOT 1
- Tk套件已安装仍报错缺失
- 找不到指定的模块: . inject HOT 4
- 只支持python3.8及以上吗? HOT 1
- LKlogger object has no attribute logt HOT 1
- Error: No such option: --format HOT 1
- ImportError: cannot import name 'std_print' from 'lk_logger.general' HOT 3
- TypeError: 'type' object is not subscriptable HOT 4
- 打包完成后出现requests不存在
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyportable-installer.