今天使用pacman -Syuu升级了一下msys2的MinGW64,结果出现了Python不能正常使用的情况,升级之前都还好好的,现在出现import找不到包。想使用pip查看安装的包的情况,如果报错: ModuleNotFoundError: No module named ‘pkg_resources’

1# pip
2Traceback (most recent call last):
3  File "G:\msys64\mingw64\bin\pip-script.py", line 6, in <module>
4    from pkg_resources import load_entry_point
5ModuleNotFoundError: No module named 'pkg_resources'

想着是不是需要升级一下pip,使用下面的命令:

1 python -m pip install --upgrade pip

报错:

1No module named pip

使用Python重新安装pip:

1# python -m ensurepip
2Looking in links: c:/Users/Administrator/AppData/Local/Temp/tmp_eytcv_c
3Processing c:/users/administrator/appdata/local/temp/tmp_eytcv_c/setuptools-56.0.0-py3-none-any.whl
4Processing c:/users/administrator/appdata/local/temp/tmp_eytcv_c/pip-21.1.3-py3-none-any.whl
5Installing collected packages: setuptools, pip
6Successfully installed pip-21.1.3 setuptools-56.0.0

成功了

1# pip -V
2pip 21.2.4 from G:/msys64/mingw64/lib/python3.9/site-packages/pip (python 3.9)

但是之前安装过的python模块不见了

1# pip list
2Package    Version
3---------- -------
4pip        21.2.4
5setuptools 56.0.0

只有重新进行安装了。