Python快速开始
更换pip源
Windows
来源
阿里巴巴镜像站pypi镜像_pypi下载地址_pypi安装教程-阿里巴巴开源镜像站 (aliyun.com)。
lwcaicsdn的博客Linux/Windows更换pip源。
操作
在"C:\Users\用户名\AppData\Roaming\"路径下新建文件夹 pip,在此文件夹下新建文件 pip.ini,写入
ini
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com安装
windows
下载
Python官网下载链接。
点击需要下载的版本,如Latest Python 3 Release - Python 3.12.6。
点击需要下载的包,如windows embeddable package(64-bit)。
安装
将下载的包解压到软件安装目录,如D:\portable\dev\python\3.12.6。
将安装目录(如D:\portable\dev\python\3.12.6)及安装目录下的Scripts文件夹(如D:\portable\dev\python\3.12.6\Scripts)(此时Scripts文件夹尚不存在,但可以提前加入环境变量)添加至系统环境变量Path。
在软件安装目录右键使用终端打开(windows10按住shift键同时点击右键呼出使用powershell打开选项)。
编辑软件安装目录中的python312._pth文件(此处的312是python3.12,如果是其他版本则是其他编号,如安装python8则编辑python38._pth),将import site前的#删掉。
运行
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py安装完成。