侧边栏壁纸
  • 累计撰写 88 篇文章
  • 累计创建 41 个标签
  • 累计收到 4 条评论

目 录CONTENT

文章目录

Python pip 删除下载的第三方库包

勤为径苦作舟
2023-11-27 / 0 评论 / 0 点赞 / 59 阅读 / 0 字

卸载 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
0

评论区