当前位置: 首页 > news >正文

卸载 PyTorch

卸载 PyTorch

  • References

https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md

To reinstall, first uninstall all existing PyTorch installs. You may need to runpip uninstall torchmultiple times. You’ll knowtorchis fully uninstalled when you seeWARNING: Skipping torch as it is not installed.
重新安装 PyTorch 之前,请先卸载所有已安装的 PyTorch。您可能需要多次运行pip uninstall torch。当您看到WARNING: Skipping torch as it is not installed时,表示torch已完全卸载。

You should only have topip uninstalla few times, but you can alwaysuninstallwithtimeoutor in a loop if you’re feeling lazy.
你只需要运行几次pip uninstall torch即可,但如果你懒得运行,也可以使用timeout或循环运行uninstall

pip uninstall torch

Next runpython setup.py clean. After that, you can install in editable mode again.
接下来运行python setup.py clean。之后,你就可以再次以可编辑模式安装。

conda uninstall pytorch -y yes | pip uninstall torch

Uninstall all existing PyTorch installs:

conda uninstall pytorch pip uninstall torch pip uninstall torch # run this command twice
yongqiang@strong-sys:~$ pip uninstall torch Uninstalling torch-1.0.0a0+46ef2b2: Would remove: /usr/local/lib/python2.7/dist-packages/caffe2 /usr/local/lib/python2.7/dist-packages/torch /usr/local/lib/python2.7/dist-packages/torch-1.0.0a0+46ef2b2.egg-info Proceed (y/n)? y Exception: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cli/base_command.py", line 143, in main status = self.run(options, args) File "/usr/local/lib/python2.7/dist-packages/pip/_internal/commands/uninstall.py", line 75, in run auto_confirm=options.yes, verbose=self.verbosity > 0, File "/usr/local/lib/python2.7/dist-packages/pip/_internal/req/req_install.py", line 683, in uninstall uninstalled_pathset.remove(auto_confirm, verbose) File "/usr/local/lib/python2.7/dist-packages/pip/_internal/req/req_uninstall.py", line 224, in remove renames(path, new_path) File "/usr/local/lib/python2.7/dist-packages/pip/_internal/utils/misc.py", line 280, in renames shutil.move(old, new) File "/usr/lib/python2.7/shutil.py", line 300, in move rmtree(src) File "/usr/lib/python2.7/shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "/usr/lib/python2.7/shutil.py", line 252, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/usr/lib/python2.7/shutil.py", line 250, in rmtree os.remove(fullname) OSError: [Errno 13] 权限不够: '/usr/local/lib/python2.7/dist-packages/caffe2/proto/metanet_pb2.py' yongqiang@strong-sys:~$ yongqiang@strong-sys:~$ sudo pip uninstall torch [sudo] yongqiang 的密码: The directory '/home/yongqiang/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Uninstalling torch-1.0.0a0+46ef2b2: Would remove: /usr/local/lib/python2.7/dist-packages/caffe2 /usr/local/lib/python2.7/dist-packages/torch /usr/local/lib/python2.7/dist-packages/torch-1.0.0a0+46ef2b2.egg-info Proceed (y/n)? y Successfully uninstalled torch-1.0.0a0+46ef2b2 yongqiang@strong-sys:~$ yongqiang@strong-sys:~$ sudo pip uninstall torch The directory '/home/yongqiang/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Skipping torch as it is not installed. yongqiang@strong-sys:~$ yongqiang@strong-sys:~$ python Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import torchvision Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/torchvision/__init__.py", line 1, in <module> from torchvision import models File "/usr/local/lib/python2.7/dist-packages/torchvision/models/__init__.py", line 1, in <module> from .alexnet import * File "/usr/local/lib/python2.7/dist-packages/torchvision/models/alexnet.py", line 1, in <module> import torch.nn as nn ImportError: No module named torch.nn >>> exit() yongqiang@strong-sys:~$
yongqiang@famu-sys:~$ sudo pip uninstall torch yongqiang@famu-sys:~$ sudo pip3 uninstall torch
yongqiang@famu-sys:~$ sudo pip uninstall torch DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. WARNING: The directory '/home/yongqiang/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Uninstalling torch-1.0.1.post2: Would remove: /usr/local/bin/convert-caffe2-to-onnx /usr/local/bin/convert-onnx-to-caffe2 /usr/local/lib/python2.7/dist-packages/caffe2/* /usr/local/lib/python2.7/dist-packages/torch-1.0.1.post2.dist-info/* /usr/local/lib/python2.7/dist-packages/torch/* Proceed (y/n)? y Successfully uninstalled torch-1.0.1.post2 yongqiang@famu-sys:~$ yongqiang@famu-sys:~$ sudo pip3 uninstall torch WARNING: The directory '/home/yongqiang/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Uninstalling torch-1.1.0: Would remove: /usr/local/lib/python3.5/dist-packages/caffe2/* /usr/local/lib/python3.5/dist-packages/torch-1.1.0.dist-info/* /usr/local/lib/python3.5/dist-packages/torch/* Proceed (y/n)? y Successfully uninstalled torch-1.1.0 yongqiang@famu-sys:~$

References

[1] Yongqiang Cheng (程永强), https://yongqiang.blog.csdn.net/
[2] 卸载 PyTorch, https://mp.weixin.qq.com/s/CY6bQ17SXXiprF1Q7EhgYA

http://www.jsqmd.com/news/1408048/

相关文章:

  • ncmdump转换指南:如何免费把网易云NCM音乐快速还原成MP3/FLAC
  • FATFS R0.15深度解析:ExFAT支持、性能优化与嵌入式项目升级指南
  • CMake install命令进阶:精准部署、条件适配与权限配置实战
  • 网页视频下载不再碰壁:猫抓资源嗅探插件的快速上手全攻略
  • C#系统颜色大全:WinForms与WPF动态主题适配与Color.FromArgb精细控制
  • Unity资源编辑器快速上手:跨平台Asset Bundle修改一次搞定
  • 软鞋皮采购避坑指南:海宁环保软鞋皮批发厂家怎么选 - 装修教育财税推荐2026
  • STM32温控开关项目实战:从模块到系统的嵌入式设计思维
  • Tomcat 8.5.58生产环境部署与调优全指南
  • 2023年Python开发环境配置指南:从零搭建Pycharm与虚拟环境
  • Blender硬表面建模效率革命:HardOps插件核心功能与实战应用
  • SketchUp STL插件完整上手指南:免费实现3D打印格式导入导出的高效方案
  • 监控数据优化实战:从源头治理到告警降噪,实现成本与效率双赢
  • 微信群消息自动转发:三分钟配置,多个群同步从此全自动
  • 2026年8月17日重庆市潼南区广电200M单宽带怎么选? - 领卡园地
  • SketchUp STL 插件从零到一:把模型变成3D打印文件的完整实操记录
  • 猫抓插件完整使用指南:网页视频、音频、图片资源一网打尽的浏览器嗅探神器
  • FairyGUI实战手册:从组件化设计到性能优化的UI开发全流程
  • UABEAvalonia 上手指南:用跨平台 Unity 资源编辑器完成你的第一个游戏 Mod
  • 2026年8月市场技术好的吹膜机生产厂家推荐,全自动背心袋制袋机/全自动制袋机/塑料造粒机/印刷机,吹膜机企业推荐 - 企业权威推荐大使
  • Echarts图表显示不全?深度解析Grid、Axis、Legend配置与空间布局优化
  • Figma Auto Layout 核心更新:嵌套布局、文件夹与像素优化实战
  • 代码整合四步法:从碎片到模块的系统化工程实践
  • 家具甲醛测试用 EN 717-1 还是 EN 16516?怎么选
  • SketchUp STL插件完整教程:从模型到3D打印,这一篇就够了
  • 域名所有权验证全攻略:从原理到实战,详解DNS、文件与元标签验证
  • 微信群消息转发怎么做?wechat-forwarding 五分钟上手完整指南
  • Windows Cleaner:让C盘“红条“消失的免费系统清理工具
  • 机器人视觉界面智能体(VIA):从视觉感知到自主决策的实践指南
  • 免命令行!NS-USBloader 用一款工具搞定 Switch 注入、传游戏与文件分割