终端运行pip升级命令:
py -m pip install --upgrade pip
pip换源(这是作为新手的我折腾了一周 从网上收集来的),以清华源为例:
方法一:
输入命令:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
方法二:
安装pqi:
pip install pqi
列出可用pip源:
pqi ls
使用清华源:
pqi use tuna
显示当前pip源:
pqi show
添加新pip源(如添加USTC源):
pqi add ustc https://mirrors.ustc.edu.cn/pypi/web/simple
移除pip源(如官方PyPi源):
pqi remove pypi
方法三(此以豆瓣源为例):
新建py文件并运行,内容如下:
#coding=utf-8
"""
Author: i@lr.cool
Date: 2018-10-18 22:22:22
Require Version: QPython 2.4.x
Desceiption: QPython更换pypi源脚本, 默认修改为豆瓣源.
"""
import os
pypi = "http://pypi.douban.com/simple/"
trusted_host = pypi.split("/")[2]
pypipath = os.environ["PYTHONHOME"] + "/bin/qpypi.py"
with open(pypipath, "r") as f:
pypilist = f.read().split("\n")
for i,line in enumerate(pypilist):
if "cmds.extend" in line:
pypilist[i] = line.replace("https://pypi.org/simple/", pypi) \
.replace("link", '"'+pypi+'"') \
.replace("trust_host", '"'+trusted_host+'"')
with open(pypipath, "w") as f:
f.write("\n".join(pypilist))
print("\npypi sources is '{}' now.\n".format(pypi))
'''
原源https://pypi.python.org/simple
https://files.pythonhosted.org/packages/
不可用https://pypi.tuna.tsinghua.edu.cn/simple/
https://mirrors.aliyun.com/pypi/simple
qpythonl3可用
https://pypi.mirrors.ustc.edu.cn/simple/
http://pypi.douban.com/simple/
qpython可用
http://pypi.douban.com/simple/
https://pypi.mirrors.ustc.edu.cn/simple/
'''
方法四:
改文件,自己百度 网上全是
手机版就不要想了,改data目录下文件贼麻烦