python3.9.2 windows安装

安装python

1.下载:python-3.9.2-embed-amd64.zip
2.解压
3.添加PATH环境变量 D:\dev\python\python\python-3.9.2-embed-amd64

4.测试:

D:\now>python
Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)] on win32
>>>

安装pip


1.修改python39._pth文件,去掉 #import site 前的 #号,否则pip安装后执行命令会报错
2.下载安装包:https://gitee.com/bai-wenzhong/get-pip/raw/master/get-pip.py
3.安装:

D:\now>python get-pip.py
Collecting pip
  Downloading pip-21.0.1-py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 39 kB/s
Collecting setuptools
  Downloading setuptools-53.0.0-py3-none-any.whl (784 kB)
     |████████████████████████████████| 784 kB 36 kB/s
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel, setuptools, pip
  WARNING: The script wheel.exe is installed in 'D:\dev\python\python\python-3.9.2-embed-amd64\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pip.exe, pip3.9.exe and pip3.exe are installed in 'D:\dev\python\python\python-3.9.2-embed-amd64\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-21.0.1 setuptools-53.0.0 wheel-0.36.2

D:\now>

4.安装路径:
D:\dev\python\python\python-3.9.2-embed-amd64\Scripts
D:\dev\python\python\python-3.9.2-embed-amd64\Lib\site-packages
5.添加PATH环境变量 D:\dev\python\python\python-3.9.2-embed-amd64\Scripts

6.测试:
pip --version     # Python2.x 版本命令
pip3 --version    # Python3.x 版本命令

pip改为国内镜像源

1.C:\Users\Administrator\pip下新建文件pip.ini,内容如下

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn

2.查看

d:\now>pip3 config list
global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'
install.trusted-host='pypi.tuna.tsinghua.edu.cn'

d:\now>

猜你喜欢

转载自blog.csdn.net/mnbwz/article/details/114039270