因为安装了其它库,导致在执行pip命令时出现错误:
D:\Python39>pip install xlrd
Traceback (most recent call last):
File "d:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\Python39\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
解决办法:
执行以下命令:python -m ensurepip
成功后,再执行pip命令试试:pip install xlrd