1 solve pip Slow way
① Temporary use of images
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider
② Once and for all
(a) stay c Off disk file box input %HOMEPATH%
(b) newly build pip Folder , New under folder pip.ini file , write in
[global]
timeout = 60
index-url = https://pypi.douban.com/simple
(c) Add... To the environment variable %HOME%\pip\pip.ini
Note several mirror website addresses :
tsinghua :https://pypi.tuna.tsinghua.edu.cn/simple
Alibaba cloud :http://mirrors.aliyun.com/pypi/simple/
University of science and technology of China https://pypi.mirrors.ustc.edu.cn/simple/
Huazhong University of technology :http://pypi.hustunique.com/
Shandong University of technology :http://pypi.sdutlinux.org/
douban :http://pypi.douban.com/simple
2 python2 and python3 The problem of coexistence
First , Install both
Suppose that the installation directories of the two are C:\Python27 and C:\Python36
hold C:\Python36 Under the python.exe Rename it to python3.exe
here , On the command prompt page , Input python refer to Python2, Input python3 refer to Python3
Input pip3 Will report a mistake “Fatal error in launcher:Unable to create process using pip3”
Enter... At the command prompt python -m pip install -U pip or python3 -m pip install -U pip Can solve
Then later pip2 Point to Python2,pip3 Point to Python3, You can use the corresponding pip Install the package for the specified version
3 View memory and cpu The occupancy of
import psutil
def getMemCpu():
data = psutil.virtual_memory()
# Total memory
total = data.total
# The remaining memory
free = data.available
# Memory usage
memory = "Memory usage:%d" % (int(round(data.percent))) + "%" + " "
# cpu Usage rate
cpu = "CPU:%0.2f" % psutil.cpu_percent(interval=1) + "%"
return memory + cpu
p{margin:10px 0}.markdown-body