Ask questionsError during import torch, NameError: name '_C' is not defined

After building from source on ubuntu 16.04 x86_64 and python 2.7.12, when I try to import torch I get the following error:

>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dusty/workspace/jetson-reinforcement/build/pytorch/torch/", line 55, in <module>
    __all__ += [name for name in dir(_C)
NameError: name '_C' is not defined

It seems to be surrounding this code in torch/

from torch._C import *

__all__ += [name for name in dir(_C)
            if name[0] != '_' and
            not name.endswith('Base')]

Any ideas of a workaround?


Answer questions XieZixiUSTC

yeah, i am getting the same problem too,may be is the problem of version or the path

Perseus Xi XieZixiUSTC DeepBlue Technology ShenZhen China Slam Machine Learning Deep Learning Computer Vision Semantic Segmentation
Github User Rank List