• Stars
    star
    736
  • Rank 61,564 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created almost 3 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🚀 Python Standalone Deploy Environment !!

PyStand

Python 独立部署环境。Python 3.5 以后,Windows 下面都有一个 Embedded Python 的独立 Python 运行环境,这个 PyStand 就是配合 Embedded Python 使用的。

特性介绍

  • 使用 PyStand + PyQt5 精简版发布 PyQt 程序,打包大小只有 14MB。
  • 使用 PyStand 发布普通 Python 程序,打包大小仅 5MB。

功能说明

  • Windows 下独立 Python 环境的启动器。
  • 自动加载 PyStand.exe 同级目录下面 runtime 子目录内的 Embedded Python。
  • 自动启动 PyStand.exe 同级目录下面的 PyStand.int 程序(Python 代码)。
  • 如果改名,会加载对应名称的 .int 文件,比如改为 MyDemo.exe 就会加载 MyDemo.int
  • 窗口程序,无 Console,但是如果在 cmd.exe 内运行,可以看到 print 的内容。
  • 会自动添加 PyStand.exe 同级目录下的 site-packages 目录,库可以放到里面。

使用方式

  • 用 CMake 生成 PyStand.exe (或者到 Release 里下个现成的)。
  • 下载 Python Embedded 版本,放到 PyStand.exe 所在目录的 runtime 子目录内。
  • 注意 Python Embedded 如果是 32 位,PyStand 配置 CMake 时也需要指明 -A Win32
  • PyStand.exe 所在目录创建 Python 源代码 PyStand.int。
  • 双击 PyStand.exe 就会运行 PyStand.int 里的代码。
  • 可以编译成命令行版方便调试,CMake 的时候加 -DPYSTAND_CONSOLE=ON 即可。

常见问题

安装依赖

用一个同 Embedded Python 相同版本的 Python 做一个 venv,然后 pip 独立安装好模块后将 site-packages 内对应的包复制到 PyStand.exesite-packages 下直接使用。

查看错误

如果在 cmd.exe 内部运行 PyStand.exe 可以看到标准输出和标准错误。不过推荐的做法是 PyStand.int 里尽量精简,比如:

import main
main.main()

把你的主程序写到 main.py 里面,用你常规方式把程序调试通顺了,然后再在 PyStand.intimport 一下即可,实在 PyStand.int 有错误,再到命令行下面去运行 PyStand.exe 查看错误。

MessageBox

PyStand 添加了一个 os.MessageBox(msg, title) 的接口,可以用来简单显示个对话框。

更换图标

可以替换 appicon.ico 文件并重新编译 PyStand.exe ,或者使用 Resource Hacker 直接 替换 Release 内下载的 PyStand.exe 文件的程序图标。

脚本组织

可以在 PyStand.exe 同级目录新建一个 script 文件夹,将脚本放进去,PyStand.int 里面就是添加一下 sys.path 然后 import 即可。

发布打包时将 script 文件夹用 zip 压缩成 script.egg 文件,PyStand.int 里检测到该文件存在就加入到 sys.path,然后再 import。

使用例子

这个回答里我说了详细的用法以及 PyInstaller 的优缺点:

更多的用法可以见 Release 下面的例子。

常见问题

其他用户使用中碰到什么疑问?如何解决的?

碰到疑问不妨快速过一下。

More Repositories

1

kcp

⚡ KCP - A Fast and Reliable ARQ Protocol
C
15,270
star
2

awesome-cheatsheets

超级速查表 - 编程语言、框架和开发工具的速查表,单个文件包含一切你需要知道的东西 ⚡
Shell
11,094
star
3

ECDICT

Free English to Chinese Dictionary Database
Python
5,922
star
4

preserve-cd

Game Preservation Project
3,654
star
5

z.lua

⚡ A new cd command that helps you navigate faster by learning your habits.
Lua
2,979
star
6

mini3d

3D Software Renderer in 700 Lines !!
C
2,173
star
7

asyncrun.vim

🚀 Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
Vim Script
1,852
star
8

RenderHelp

⚡ 可编程渲染管线实现,帮助初学者学习渲染
C++
1,333
star
9

vim-quickui

The missing UI extensions for Vim 9 (and NeoVim) !! 😎
Vim Script
1,094
star
10

vim

Personal Vim Profile
Vim Script
911
star
11

asynctasks.vim

🚀 Modern Task System for Project Building, Testing and Deploying !!
Vim Script
910
star
12

vim-init

轻量级 Vim 配置框架,全中文注释
Vim Script
907
star
13

emake

你见过的最简单的 GCC/CLANG 项目构建工具,定义式构建,比命令式更简单
Python
802
star
14

FastMemcpy

Speed-up over 50% in average vs traditional memcpy in gcc 4.9 or vc2012
C
585
star
15

preserve-iso

绝版软件保护工程
580
star
16

avlmini

AVL implementation which is as fast/compact as linux's rbtree
C
347
star
17

quickmenu.vim

A nice customizable popup menu for vim
Vim Script
275
star
18

vim-auto-popmenu

😎 Display the Completion Menu Automantically (next AutoComplPop) !!
Vim Script
271
star
19

gutentags_plus

The right way to use gtags with gutentags
Vim Script
266
star
20

vim-terminal-help

Small changes make vim/nvim's internal terminal great again !!
Vim Script
243
star
21

translator

命令行聚合翻译工具,支持谷歌,必应,有道,百度,词霸,360
Python
227
star
22

ECDICT-ultimate

Ultimate ECDICT Database
219
star
23

GONGLUE

单机游戏攻略秘籍(1580+ 篇)
Python
180
star
24

vim-preview

The missing preview window for vim
Vim Script
167
star
25

pixellib

High Quality 2D Graphics Library
C
157
star
26

KanaQuiz

Hiragana/Katakana Speed Reading Quiz in Command Line !! 😎
Python
147
star
27

images

Static Page
C++
144
star
28

BasicBitmap

Simple and high-performance and platform independent Bitmap class (34% faster than GDI/GDI+, 40% faster than DDraw)
C++
131
star
29

AsyncNet

AsyncNet
C
117
star
30

gobang

Gobang game with artificial intelligence in 900 Lines !!
Python
115
star
31

vim-rt-format

😎 Prettify Current Line on Enter !!
Vim Script
113
star
32

vim-keysound

🍷 Play typewriter sound in Vim when you are typing a letter
Vim Script
112
star
33

Intel2GAS

Convert MSVC Style Inline Assembly to GCC Style Inline Assembly
Python
103
star
34

CloudClip

Your own clipboard in the cloud, copy and paste text with gist between systems !!
Python
79
star
35

googauth

The Python Command-line Reimplementaion of Google Authenticator
Python
74
star
36

LIBLR

Parser Generator for LR(1) and LALR
Python
68
star
37

markpress

Write WordPress in Markdown in Your Favorite Text Editor !! 😎 😎
Python
67
star
38

vim-dict

没办法,被逼的,重新整理一个词典补全的数据库
Vim Script
56
star
39

terminal

Open Terminal Window to execute command in Windows / Cygwin / Ubuntu / OS X
Python
51
star
40

LeaderF-snippet

Intuitive Way to Use Snippet
Vim Script
46
star
41

nanolib

Cross-Platform Networking Library
C
44
star
42

vim-gpt-commit

🚀 Generate git commit message using ChatGPT in Vim (and NeoVim) !!
Python
43
star
43

czmod

🚀 Native Module Written in C to Boost z.lua !!
C
42
star
44

collection

没地方放的代码,懒得开新项目了,放这里吧。
Python
40
star
45

atom-shell-commands

Execute user defined shell commands (looking for new maintainers)
JavaScript
36
star
46

vim-navigator

🚀 Navigate Your Commands Easily !!
Vim Script
32
star
47

lemma.en

English Lemma Database - Compiled by Referencing British National Corpus
29
star
48

ml

Machine Learning From Scratch
C
28
star
49

memslab

Slab Memory Allocator in Application Layer
C
28
star
50

asyncrun.extra

Extra runners for asyncrun to run your command in Tmux/Gnome-terminal panel, xterm, Floaterm and more.
Vim Script
27
star
51

vim-color-patch

🌈 Load colorscheme patch script automatically !!
Vim Script
25
star
52

zvi

🚀 Smallest Vi-clone Text Editor for Windows CLI and SSH session (only 62KB) !!
23
star
53

vim-color-export

🌈 A tool to backport NeoVim colorschemes to Vim !!
Vim Script
20
star
54

QuickNet

UDP Networking Library
C
19
star
55

asmpure

Asmpure is a library written in C for compiling assembly code at run-time
C
16
star
56

docker

Docker Images
Python
16
star
57

VmBasic

基于虚拟机的仿 QuickBasic 语言
C++
15
star
58

vim-cppman

Read Cppman/Man pages right inside your vim.
Vim Script
15
star
59

language

Language Collection
Python
12
star
60

tcz_cd

Autojump for Total Commander !!
Python
11
star
61

LanguageMark

Native Language Benchmark in Numerous Algorithms
C
9
star
62

abandonware

Abandonware Collection
9
star
63

rogue-clone

A fork of rogue-clone with bug fixes and improvements.
C
8
star
64

vim-proposal

Collection of Proposals for Vim
TypeScript
7
star
65

gosub

Golang Sub-routines for Network Development
Go
7
star
66

winxp-editors

🍷 Text Editors Preservation Project for Windows XP+
Batchfile
7
star
67

cannon

Cross Platform Network Framework
C
6
star
68

shell-scripts

常用的命令行脚本合集,让你每天的命令行生活更加高效
Shell
6
star
69

crtzero

Zero Dependent on CRT (libc)
C
6
star
70

pyp2p

Python P2P Framework
Python
6
star
71

SimdVector

Cross Platform SIMD Vector Math In A Single Header File (SimdVector.h)
C++
5
star
72

support

Win32 Command Line Tools for Development
Python
5
star
73

treasure

Single-file MIT Licensed C/C++ Portable Libraries
C
4
star
74

asyncredis

Async Redis Client for Python
Python
3
star
75

skywind

Personal Blog
HTML
3
star
76

directx9-samples

samples
C++
3
star
77

gfx

Just Another Toy yet !!
C++
3
star
78

script

Script I am using
Python
3
star
79

colors-from-neovim.vim

🌈 Backported NeoVim Colors for Vim
Vim Script
3
star
80

ones

One single file MIT licensed C/C++ Libraries
2
star
81

asclib

Basic Java Network Lib
Java
2
star
82

transmod

Automatically exported from code.google.com/p/transmod
C
2
star
83

toys

My PyQt Desktop Toys
Python
2
star
84

rust

Rust Learning Repository
1
star
85

vile

Vile the vi-clone text editor
C
1
star
86

xvi

A portable multi-file text editor and the smallest full-function vi clone
C
1
star
87

emacs

Personal Emacs Profile
Emacs Lisp
1
star
88

cmake-scratch

Cmake Templates
CMake
1
star