Windows下制作Python便携版--Portable Python
下载Python
从官网下载Embeded版本python
curl -L https://www.python.org/ftp/python/3.7.9/python-3.7.9-embed-amd64.zip -o %tmp%\python-3.7.9.zip
解压
把下载下来的zip文件解压
set destdir=c:\Python37
powershell -c "Expand-Archive -Path \"${env:tmp}\python-min.zip\" -DestinationPath \"${env:destdir}\" -force"
下载get-pip.py
从官网下载get-pip.py
curl -L https://bootstrap.pypa.io/get-pip.py -o %destdir%\get-pip.py
安装pip
进入python目录,安装pip
cd %destdir%
python get-pip.py
设置python自动寻找pip
打开文件 python37._pth
去掉 import site 前的注释符号
python37.zip
.
# Uncomment to run site.main() automatically
import site
执行pip
不要直接使用pip命令
python -m pip