python学习日记(1)

@TOC## python学习日记

更新pip且更换清华源来下载库

更换源时会遇到这种问题:

WARNING: The repository located at pypi.tuna.tsinghua.edu.cn is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with ‘–trusted-host pypi.tuna.tsinghua.edu.cn’.
ERROR: Could not find a version that satisfies the requirement SomePackage (from versions: none)
ERROR: No matching distribution found for SomePackage
WARNING: The repository located at pypi.tuna.tsinghua.edu.cn is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '–trusted-host

pypi.tuna.tsinghua.edu.cn’.

可以先在电脑文件搜索:%appdata%找到pip文件夹下的pip.ini文件
编辑:
[global]
timeout = 6000
index-url = http://pypi.tuna.tsinghua.edu.cn/simple/
trusted-host=pypi.tuna.tsinghua.edu.cn

回到cmd,输入:
python -m pip install -U pip

出现如下结果即成功。
python学习日记(1)

安装库:
pip install [name]
python学习日记(1)