{"id":25313787,"url":"https://github.com/meng89/wpi","last_synced_at":"2025-10-28T17:31:13.838Z","repository":{"id":62589508,"uuid":"85577361","full_name":"meng89/wpi","owner":"meng89","description":"Windows Printer Installer","archived":false,"fork":false,"pushed_at":"2017-04-13T06:38:03.000Z","size":133,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T19:46:50.148Z","etag":null,"topics":["automatic","install","printer","python","windows"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meng89.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-20T13:02:32.000Z","updated_at":"2019-06-24T08:12:25.000Z","dependencies_parsed_at":"2022-11-03T17:01:29.595Z","dependency_job_id":null,"html_url":"https://github.com/meng89/wpi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meng89%2Fwpi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meng89%2Fwpi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meng89%2Fwpi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meng89%2Fwpi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meng89","download_url":"https://codeload.github.com/meng89/wpi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238461528,"owners_count":19476343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automatic","install","printer","python","windows"],"created_at":"2025-02-13T16:23:38.961Z","updated_at":"2025-10-28T17:31:13.422Z","avatar_url":"https://github.com/meng89.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Windows Printer Installer\n=========================\n\nWPI 是一个使用 Python 3 编写，在 Windows 下使用的，安装非本地打印机 （包括驱动，端口） 的工具。\n\n如果你想运行一下程序就自动安装好多个 *共享的* 打印机或 *TCPIP* 打印机，这个程序就是你要找的。\n\n\n通过 Resilio Sync (原 BitTorrent Sync)  直接获取独立程序\n=============================================\n\n如果你只想获取独立的程序，那么需使用 Resilio Sync 同步以生成好的程序。\n\nResilio Sync 下载地址：\n\nhttps://www.resilio.com/platforms/desktop/\n\n同步密钥：\n\nBQ5LNWA34LIG3ETZMJ73ZEGMBW4P2WX24\n\n\n通过 Python 模块方式安装\n================\n\n先安装 `Python 3 \u003chttps://www.python.org/downloads/windows/\u003e`_ (建议选择的 32位 3.4 版)，安装时注意勾选 pip 组件。\n\n然后手动下载安装相应版本的 `pywin32 \u003chttps://sourceforge.net/projects/pywin32/files/pywin32/\u003e`_\n\n再以管理员管理员权限运行：\n::\n\n    pip install wpi\n\n\n完成安装后，wpi 应该就可以直接在命令行下运行了。\n\n注：为了解压在压缩包里的驱动，应当下载安装 `7-Zip \u003chttp://www.7-zip.org/download.html\u003e`_ ，\n如果想把 wpi 打包成可以多系统下执行的独立程序，应当安装32位的 7-Zip\n\n生成独立的程序\n-------\n\n如果想在没有 Python 环境的系统下运行，得把 Python 环境和 wpi 及其依赖的模块打包在一起。\n先安装 Pyinstaller：\n::\n\n    pip install pyinstaller\n\n\n然后运行 wpi 的打包命令:\n::\n\n   wpi2exe\n\n\n这样会生成独立的 exe 文件， wpi2exe 使用 *LOCALAPPDATA%\\\\wpi2exe\\\\config.py* 作为配置文件，如果此文件不存在，*wpi2exe* 会自动创建它。\n可以编辑它以设置输出目录等。正如后缀名所示，此配置文件是一个 Python 脚本。\n\n\n参数用法\n====\n命令行参数的定义类似 Python 函数。\n\n具名参数运行例子:\n::\n\n    wpi ps=my_printers.py drivers=my_drivers_dir\n\n\n参数 ps\n-----\n*ps* 用来指定一个已定义了打印机列表的文件。\n\n\n参数 drivers\n----------\n*drivers* 用来指定驱动程序的总目录。\n\n\n不提供参数时程序运行的方式\n-------------\n当没有提供 *ps* 时，程序会使用 *默认资源目录* 下的 *ps.py* 文件作为默认打印机列表文件以直接安装打印机， 如果不存在则会进入 *交互模式*。\n\n当没有提供 *drivers* 时，程序会使用 *默认资源目录* 下的 *drivers* 目录作为默认参数。\n\n\n默认资源目录在哪？\n---------\n\n以独立程序运行时，默认资源目录既是程序所在的目录。\n\n以模块脚本方式运行程序时，默认资源目录是 *%LOCALAPPDATA%\\\\wpi* 。\n\n%LOCALAPPDATA% 在哪？\n``````````````````\n它是一个环境变量，如果你的账户名是 *韩梅梅*，而且系统是 Windows 7 的话，\n那么 *%LOCALAPPDATA%* 可能就是： *C:\\\\Users\\\\韩梅梅\\\\AppData\\\\Local\\\\*\n\n\n交互式界面的用法\n========\n提示输入时，可以直接输入 ps 文件的路径，或输入 m/l 命令（见下面的作用说明），退出时用 q 命令。\n\nm 命令\n----\n\n1. 创建样例打印机列表文件\n``````````````\n会在 *默认资源目录* 里创建名为 *_ps.py* 的样例打印机列表文件以作为编写打印机列表文件时的参考。\n\n2. 创建供存放打印机驱动的目录结构\n``````````````````\n会在 *默认资源目录* 里创建名为 *drivers* 的目录和以 *系统位数*，*发行版本* 为名的子目录。\n\n你应该把驱动程序包根据适用情况，放在合适的目录里。\n\n驱动程序包裹可放置在特定的发行版本目录下，也可放置在上一级，这样就表示这个驱动可用于多系统。\n\n下载的驱动文件只要是 7-Zip 可以解包（解压）的文件就无需手动解包。程序会自动寻找包裹里的 inf 文件并比较在打印机列表文件里给定的驱动名，符合就会使用此包裹里的这个 inf 文件。\n包裹里的 inf 文件只能在第一级包裹里，举个反例: 把 inf 打包为包裹1，然后把包裹1再打包成包裹2。这样的情况下程序就找不到 inf 文件了，因为包裹2的文件列表里无 inf 文件！\n\nl 命令\n----\n列出 包裹文件里的inf文件 或 inf文件里 的驱动名。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeng89%2Fwpi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeng89%2Fwpi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeng89%2Fwpi/lists"}