主题
py3.10.10 整合包下载链接
https://pan.baidu.com/s/1UsfZS-Nl9hxLOB59acTBBg?pwd=y2cg
如链接失效,请联系我
制作流程
1、下载python embedding
https://www.python.org/downloads/windows/
选择目标版本,比如:https://www.python.org/ftp/python/3.10.10/python-3.10.10-embed-amd64.zip
解压到指定的目录,此处用 py310
2、获取pip
下载pip安装文件:https://bootstrap.pypa.io/get-pip.py
shell
python.exe get-pip.py -i https://mirrors.aliyun.com/pypi/simple/
将上面安装命令放到
update_pip.bat
文件中,即可解决SyntaxError: Non-UTF-8 code starting with '\x90' in file 问题
安装成功后,会在py310目录下多出Lib、Scripts
Lib就是存在后续安装依赖包的地方
Scripts则是依赖包的可执行脚本,比如streamlit、pip、wheel
后续可直接使用pip
命令安装依赖包,比如安装streamlit
shell
.\py310\Scripts\pip3 install streamlit -i https://mirrors.aliyun.com/pypi/simple/
tips:指定镜像源
shell
.\py310\Scripts\pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/
3、修改python310._path
支持py310和上级目录
文件的引用
python
python310.zip
.
..
# Uncomment to run site.main() automatically
import site
示例启动项目脚本:start.bat
shell
echo off
chcp 65001 > NUL
echo 敏哥开源开发
.\py310\python.exe helloworld.py
chcp 65001 > NUL 解决中文输出乱码