python入门必会
一、windows下python的安装
- 打开官网(https://www.python.org),选择Downloads(也可应用商店直接下载)
 2.然后选择相应的版本python3.xxxx  3.下载完成后打开,这里我下载的是python 3.6.4  (1)勾选Add Python 3.6 to PATH是把Python的安装路径添加到系统环境变量的Path变量中(这样我们就少一步自己添加环境变量啦_) (2)选择Install Now默认将pythone安装在C盘目录下(作为一个新时代好少女,我当然不会选择这个(?▽?)) (3)选择Customize installation可自定义路径(我选这个) - 选择Customize installation后,这一步默认全选,然后点击next(这里看到我是真的选了下载pip的,后来不知道为什么没有下载,导致我的入门遇到顶级灾难o(╥﹏╥)o)
 3.这一步要勾选上Install for all users,路径根据自己的需要选择(我安装在了F盘下的Python36文件夹下) 4.点击Install,就开始安装啦,过程很快  安装成功  5.验证一下是否安装成功 
转载自:大橘子呀
二、手动将python配置到系统环境
1.右击此电脑,点击属性,选择高级设置,然后点击环境变量(N)  2.双击path(用户变量和系统变量都可以) 
- 点击新建,比如新建一个D://python3.10

三、python第三方库换源的方法
(以numpy为例)
- pip换源
a. 临时换源:
pip install requests -i http://pypi .tuna.tsinghua.edu.cn/simple/
b.永久修改(不建议永久换源): 打开此电脑,搜索%APPDATA% 按回车,跳转到以下目录,新建pip文件夹 创建pip.ini文件 打开文件夹,输入以下内容,关闭即可(镜像源可更换)
阿里云: http://mirrors.aliyun.com/pypi/simple/ 中国科技大学: https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(douban): http://pypi.douban.com/simple/ 清华大学: http:/pypi.tuna.tsinghua.edu.cn/simple/ 中国科学技术大学: http:/pypi.mirrors.ustc.edu.cn/simple/
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
2.whl 换源,以numpy为例(whl库可离线安装,但下载whl库需要网络)
打开网址Python Extension Packages for Windows
下载相应的whl文件(按Ctrl + F搜索numpy,点击numpy) 
选择相应python版本的库下载
 下载好后将安装包迁移到python路径下去 比如:d:\python3.9\python.exe\lib\site-packages
然后再cmd执行命令:
pip install numpy
完成后会显示安装成功的 
|