Python pits

I will open a topic here to record some of the problems encountered in the process of using Python, and the solutions.


Continually updated……


Article Directory

pip problem

In the process of using Python, many problems are caused by pip. ImportError: No module named packaging.version may also occur after pip update.
Solution: re-download pip installation

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

pip install is slow

Solution: Use the domestic mirror source
pypi mirror to synchronize every 5 minutes.

  1. temporary use
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

Note that simple cannot be less, it is https instead of http

  1. Set as default
    Upgrade pip to the latest version (>=10.0.0) and configure:
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

Guess you like

Origin blog.csdn.net/weixin_44456692/article/details/106185269