卸载 PyTorch
卸载 PyTorchReferenceshttps://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.mdTo 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 torchNext runpython setup.py clean. After that, you can install in editable mode again.接下来运行python setup.py clean。之后你就可以再次以可编辑模式安装。conda uninstall pytorch -y yes | pip uninstall torchUninstall all existing PyTorch installs:conda uninstall pytorch pip uninstall torch pip uninstall torch # run this command twiceyongqiangstrong-sys:~$ pip uninstall torch Uninstalling torch-1.0.0a046ef2b2: 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.0a046ef2b2.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_confirmoptions.yes, verboseself.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 yongqiangstrong-sys:~$ yongqiangstrong-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 sudos -H flag. Uninstalling torch-1.0.0a046ef2b2: 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.0a046ef2b2.egg-info Proceed (y/n)? y Successfully uninstalled torch-1.0.0a046ef2b2 yongqiangstrong-sys:~$ yongqiangstrong-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 sudos -H flag. Skipping torch as it is not installed. yongqiangstrong-sys:~$ yongqiangstrong-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() yongqiangstrong-sys:~$yongqiangfamu-sys:~$ sudo pip uninstall torch yongqiangfamu-sys:~$ sudo pip3 uninstall torchyongqiangfamu-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 wont 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 sudos -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 yongqiangfamu-sys:~$ yongqiangfamu-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 sudos -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 yongqiangfamu-sys:~$References[1] Yongqiang Cheng (程永强), https://yongqiang.blog.csdn.net/[2] 卸载 PyTorch, https://mp.weixin.qq.com/s/CY6bQ17SXXiprF1Q7EhgYA

相关新闻

输入法词库迁移终极自救指南:深蓝词库转换如何免费搞定 50+ 种格式互通

输入法词库迁移终极自救指南:深蓝词库转换如何免费搞定 50+ 种格式互通

输入法词库迁移终极自救指南:深蓝词库转换如何免费搞定 50 种格式互通 【免费下载链接】imewlconverter ”深蓝词库转换“ 一款开源免费的输入法词库转换程序 项目地址: https://gitcode.com/gh_mirrors/im/imewlconverter 你有没有经历过这样的崩溃瞬间&…

2026/11/6 1:53:19 阅读更多 →
三步搞定SketchUp STL导入导出:免费开源插件打通3D打印全流程实战指南

三步搞定SketchUp STL导入导出:免费开源插件打通3D打印全流程实战指南

三步搞定SketchUp STL导入导出:免费开源插件打通3D打印全流程实战指南 【免费下载链接】sketchup-stl A SketchUp Ruby Extension that adds STL (STereoLithography) file format import and export. 项目地址: https://gitcode.com/gh_mirrors/sk/sketchup-stl …

2026/11/2 18:35:56 阅读更多 →
Apifox WebSocket调试:从手动脚本到自动化测试的完整实践

Apifox WebSocket调试:从手动脚本到自动化测试的完整实践

1. 项目概述:为什么我们需要一个强大的WebSocket调试工具?如果你是一名前后端开发,或者经常和实时数据、消息推送、在线协作这类场景打交道,那么WebSocket对你来说肯定不陌生。它不再是那个“听说过但没用过”的协议,而…

2026/10/25 21:27:20 阅读更多 →

最新新闻

Electron桌面应用开发实战:从环境搭建到打包发布全流程

Electron桌面应用开发实战:从环境搭建到打包发布全流程

做前端这些年,我大部分时间都在跟浏览器标签页打交道,直到第一次把桌面应用跑起来,才发现原来自己一直被限制在地址栏和刷新按钮围起来的框框里。Electron这个词,最开始是在某段时间频繁出现在同事的讨论里,一个用HTML…

2026/11/5 12:28:00 阅读更多 →
滑盖智能锁T109深度解析:结构原理、安装调试与故障排查

滑盖智能锁T109深度解析:结构原理、安装调试与故障排查

简介:亚太天能T109滑盖智能锁产品说明书是一份PDF格式的官方技术文档,主要面向智能锁安装人员、终端用户及售后维护者,帮助快速掌握产品安装、配置与常见故障处理。全包仅1个PDF文件,大小4.37MB,内容结构清晰&#xff…

2026/11/5 1:08:50 阅读更多 →
PMSM弱磁控制原理与Simulink建模:高速AGV驱动系统设计指南

PMSM弱磁控制原理与Simulink建模:高速AGV驱动系统设计指南

上个月我在调试一台高速AGV的驱动系统,整车要求空载跑到8m/s,电机转速已经拉到额定点,驱动器的输出电压也顶到了母线电压极限附近。再往上踩速度指令,转速纹丝不动,三相电流反而开始震荡。那会儿我的第一反应就是&…

2026/11/5 12:28:01 阅读更多 →
C++核心知识点:从内存管理到STL的实战指南

C++核心知识点:从内存管理到STL的实战指南

C 这门语言我前前后后折腾了十几年,用它写过嵌入式驱动、做过游戏服务端,也搭过基础组件库。每次看到新人一头扎进"C 核心知识点"这个搜索词,我其实挺感慨的——这门语言的难点从来不是语法多,而是知识点之间的耦合太深…

2026/11/5 12:28:02 阅读更多 →
T109滑盖智能锁怎么装?安装调试与故障排查全攻略

T109滑盖智能锁怎么装?安装调试与故障排查全攻略

简介:亚太天能T109滑盖智能锁产品说明书以PDF格式发布,适合智能锁用户、安装人员与售后维修人员阅读。内容围绕T109系列指纹密码刷卡锁展开,先介绍前面板、后面板、锁体、机械钥匙、电池盒盖等部件名称与功能,再给出完整安装步骤&…

2026/11/5 0:54:28 阅读更多 →
LLM知识降熵:从信息垄断到理解权下放

LLM知识降熵:从信息垄断到理解权下放

你有没有过这种经历:翻开源码注释、论文摘要或者一份专业报告,每个字都认识,连在一起却像天书。想找人聊聊,身边要么没人懂,要么懂的懒得跟你解释。后来我试着把同一段内容丢给一个大语言模型,几秒钟之后&a…

2026/11/5 19:38:59 阅读更多 →

日新闻

周新闻

月新闻