1. 程式人生 > >ubuntu 16.04 Caffe2 / PyTorch - 解除安裝 PyTorch

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
[email protected]:~$ 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'
[email protected]
:~$ 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
[email protected]
:~$ 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.
[email protected]
:~$ [email protected]:~$ 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. [email protected]:~$ 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() [email protected]:~$