Install Pytorch

Pytorch主页 <http://pytorch.org/>; 会告诉你什么类型OS,什么version的python,及什么样的安装方式 下的应该使用相应的安装命令。

Pytorch Doc: http://pytorch.org/docs/master/

$ cd~/anaconda/bin

$ conda install pytorch torchvision -c soumith

pytorch import error:

>>> import torch
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/davidm/anaconda/lib/python2.7/site-packages/torch/__init__.py", line 53, in <module>
    from torch._C import *
ImportError: numpy.core.multiarray failed to import

解决方法:

1.删除tuna 镜像
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --show-sources

2. install numpy
conda install numpy

就OK了

results matching ""

    No results matching ""