卸载 requirements.txt 库 pip uninstall -r requirements.txt 卸载所有库并恢复 pip # 查看 site-packages 目录 $ python -m site sys.path = [ 'C:\\Users\\Administrator', 'D:\\ProgramFiles\\Python\\Python310\\python310.zip', 'D:\\ProgramFiles\\Python\\Python310\\DLLs', 'D:\\ProgramFiles\\Python\\Python310\\lib', 'D:\\ProgramFiles\\Python\\Python310', 'D:\\ProgramFiles\\Python\\Python310\\lib\\site-packages', 'D:\\ProgramFiles\\Python\\Python310\\lib\\site-packages\\win32', 'D:\\ProgramFiles\\Python\\Python310\\lib\\site-packages\\win32\\lib', 'D:\\ProgramFiles\\Python\\Python310\\lib\\site-packages\\Pythonwin', ] USER_BASE: 'C:\\Users\\Administrator\\AppData\\Roaming\\Python' (doesn't exist) USER_SITE: 'C:\\Users\\Administrator\\AppData\\Roaming\\Python\\Python310\\site-packages' (doesn't exist) ENABLE_USER_SITE: True # 删除 site-packages 目录 # cmd $ rd /s /q D:\\ProgramFiles\\Python\\Python310\\lib\\site-packages # powershell $ Remove-Item D:\\ProgramFiles\\Python\\Python310\\lib\\site-packages -Recurse -Force # linux $ rm -rf D:\\ProgramFiles\\Python\\Python310\\lib\\site-packages # 恢复 pip $ python -m ensurepip $ python -m pip install --upgrade pip
评论区