Bugs and solutions when Python common guide library

Preface

 The author encountered common problems when using win10 python3 version guide library in junior year, and the final solution summary.

  1. The command window displays when using pip:

File “D:\Program_for_code\python\Scripts\pip.exe_main_.py”, line 5, in
ModuleNotFoundError: No module named ‘pip’

After nearly 2 errors reported without using py, the solution is to use the command window to go to the specified python installation directory

D:
#更换系统盘(这里将python安装在D盘)
cd "D:\Program_for_code\python"
# 到指定目录


Insert picture description here

Then update pip:

python -m ensurepip
python -m pip install --upgrade pip

update complete

  1. pip install download library is too slow.
    Since the library resources of python mainly come from the
    Insert picture description here
    Insert picture description here
    external network , there will always be too slow and download failure when downloading the library: you can see that you can directly use the external network 1.5 when updating pip M's resource package finally timed out directly on the spot.
    Two solutions can be used to solve this problem, one is to change the download time limit, and the other is to use the domestic mirroring website to download (the network speed increases without worrying about the timeout problem). Here I recommend using the latter to solve the problem.
  • Recommended mirroring websites

http://pypi.douban.com/simple --trusted-host pypi.douban.com
(more than one website, readers and friends are welcome to add)

New install library command:

python -m pip install --upgrade pip -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

Insert picture description here
After switching to a mirrored website, the network speed has increased to 1.6M/.s, and it only takes less than 1s to update pip.
After pip is updated, the command window pip can be used normally again.
Insert picture description here

Guess you like

Origin blog.csdn.net/Zengmeng1998/article/details/108436395