ubuntu 16.04 Caffe2 / PyTorch - 卸载 PyTorch

ubuntu 16.04 Caffe2 / PyTorch - 卸载 PyTorch

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

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:~$ 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:~$ 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:~$ 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:~$ 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:~$ 

猜你喜欢

转载自blog.csdn.net/chengyq116/article/details/83818736