赞
踩
Python3 官方文档位于 https://docs.python.org/3/ , 有时候网络无法连接,或者连接速度慢, 这对于学习 Python 时的反馈造成了负面影响。准备一份本地 Python 文档可以让反馈更加及时。
下面给出 macOS 和 Win11 下的 Python 离线文档安装和查看方式。
本地是 macOS 系统。
下载 python html 格式文档
https://docs.python.org/3/download.html
下载logo png图像
https://www.python.org/community/logos/
创建 PythonDoc.sh, 用于创建 PythonDoc.app:
#!/bin/bash # This script generates /Application/PythonDoc.app, which can be searched in launchpad # You should have already downloaed Python HTML document from https://docs.python.org/3/download.html mkdir -p ~/Applications/PythonDoc.app/Contents/MacOS mkdir -p ~/Applications/PythonDoc.app/Contents/Resources cat <<EOF > ~/Applications/PythonDoc.app/Contents/MacOS/PythonDoc #!/bin/bash open /Users/zz/Documents/python-3.12.5-docs-html/index.html EOF chmod +x ~/Applications/PythonDoc.app/Contents/MacOS/PythonDoc cat <<EOF > ~/Applications/PythonDoc.app/Contents/Info.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleExecutable</key> <string>PythonDoc</string> <key>CFBundleIdentifier</key> <string>org.python.doc</string> <key>CFBundleName</key> <string>PythonDoc</string> <key>CFBundleVersion</key> <string>1.0</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleIconFile</key> <string>Python.icns</string> </dict> </plist> EOF cp python-logo-only.icns ~/Applications/PythonDoc.app/Contents/Resources/Python.icns rm -rf /Applications/PythonDoc.app mv ~/Applications/PythonDoc.app /Applications/
效果:
下载 Python html 格式文档: https://docs.python.org/3/download.html
解压到 D:/docs/python-3.12.5-docs-html
目录
进入 C:\ProgramData\Microsoft\Windows\Start Menu\Programs
目录, 创建 Python
目录
进入 D:/docs/python-3.12.5-docs-html
目录, 创建 index.html
的快捷方式,并剪切到 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python
目录, 重命名为 Python Documentation.html
文件:
进入开始菜单,输入 Python doc,可以看到创建的应用:
执行查询:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。