MAC安装pytorch

在机器学习常用的python包anconda下,安装pytorch的步骤非常简答

安装命令:

conda install pytorch torchvision -c pytorch -y

直接一步到位!

 

如果安装过程中,出现下面的连接http时获取URL内容方面的错误时,没关系,再重新运行安装命令,多试几次,相信你总能成功的!

Downloading and Extracting Packages
pytorch-1.1.0        | 49.9 MB   | ################7                                                                                                     |  14%

CondaHTTPError: HTTP 000 CONNECTION FAILED for url 
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

验证安装是否成功:

import torch
print(torch.rand(2, 3))

执行后输出类似于:

tensor([[0.6122, 0.4238, 0.0422],
        [0.8809, 0.5974, 0.5142]])

恭喜你安装成功!

你可能感兴趣的:(python,深度学习/机器学习)