博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
pytorch macos_Windows,Linux和MacOS上的PyTorch安装
阅读量:2533 次
发布时间:2019-05-11

本文共 4789 字,大约阅读时间需要 15 分钟。

pytorch macos

The installation of PyTorch is pretty straightforward and can be done on all major operating systems. However, if you want to get your hands dirty without actually installing it, provides a good starting point.

PyTorch的安装非常简单,可以在所有主要操作系统上完成。 但是,如果您想在不进行实际安装的情况下弄脏手,则提供了一个很好的起点。

Colab comes with preinstalled PyTorch and Tensorflow modules and works with both GPU and TPU support.

Colab随附了预装的PyTorch和Tensorflow模块,并与GPU和TPU支持一起使用。

For installation on your own computer, PyTorch comes with both the CUDA and no CUDA versions, depending upon the hardware available to you.

为了在您自己的计算机上安装,PyTorch随附CUDA和不提供CUDA版本,具体取决于您可用的硬件。

This will be a single step installation – .

这将是一步安装– 。

Prerequisite: – You need Anaconda installed on your system to follow this tutorial. The download packages are available for all major operating systems and the process of installation is very straight forward.

先决条件: –您需要在系统上安装Anaconda才能遵循本教程。 下载包适用于所有主要操作系统,安装过程非常简单。

So before you go ahead with the tutorial, make sure you have an up and running Anaconda distribution set up on your operating system.

因此,在继续学习本教程之前,请确保已在操作系统上建立并运行了Anaconda发行版。

Note: In case you don’t want to use Anaconda, you can always use PIP to install PyTorch. Since PIP comes bundled with Python installer, you will already have it in your system.

注意 :如果您不想使用Anaconda,则可以始终使用PIP安装PyTorch。 由于PIP与Python安装程序捆绑在一起,因此您已经将其安装在系统中。

在Windows上安装Pytorch (Install Pytorch on Windows)

The PyTorch website provides the following command for the windows system. PyTorch works with Windows 7 or higher and uses Python 3 or higher. Installing it using Anaconda is quite simple and can be done in a few minutes.

PyTorch网站为Windows系统提供以下命令。 PyTorch可在Windows 7或更高版本上使用,并使用Python 3或更高版本。 使用Anaconda进行安装非常简单,只需几分钟即可完成。

PyTorch Installation 1
PyTorch Installation 1
PyTorch安装1

The next step is to paste the following command in your Anaconda prompt and run it.

下一步是将以下命令粘贴到Anaconda提示符中并运行它。

conda install pytorch torchvision cpuonly -c pytorch

The prompt will list out all the dependencies that will be installed along with PyTorch. If you are okay to proceed, type yes in the command line.

该提示将列出将与PyTorch一起安装的所有依赖项。 如果可以继续,请在命令行中输入yes。

PyTorch Installation in Windows
PyTorch Installation 2
PyTorch安装2

Anaconda now proceeds with the installation. You can check the installation through the Python interpreter or a Jupyter Notebook later.

Anaconda现在继续安装。 您可以稍后通过Python解释器或Jupyter Notebook检查安装。

PyTorch Version Check
PyTorch Version
PyTorch版本

Now you have successfully installed PyTorch on your Windows system.

现在,您已经在Windows系统上成功安装了PyTorch。

在Linux上安装PyTorch (Installing PyTorch on Linux)

If you open the same installation page from a Linux machine, you will notice that the generated command will be a different one.

如果从Linux机器打开相同的安装页面,则会注意到生成的命令将是不同的命令。

PyTorch Linux
PyTorch Linux
PyTorch Linux

The next step is to copy and paste the command into your terminal and run it.

下一步是将命令复制并粘贴到终端中并运行它。

conda install pytorch torchvision cpuonly -c pytorch
Pytorch Ubuntu Installation
Pytorch Ubuntu Installation
Pytorch Ubuntu安装

The terminal asks you for permission to install/update packages. You need to press yes as a response.

终端会要求您许可安装/更新软件包。 您需要按

Pytorch Ubuntu Packages
Pytorch Ubuntu Packages
Pytorch Ubuntu软件包

The installation will now continue to install torch and torchvision packages into your environment.

现在,安装将继续将TorchTorchvision软件包安装到您的环境中。

Pytorch installation in Ubuntu Progress
Pytorch Ubuntu Progress
Pytorch Ubuntu进展

在Mac OS上安装PyTorch (Installing PyTorch on Mac OS)

We will use PIP to install PyTorch in Mac OS. All we need is to select the appropriate options on the PyTorch home page to get the install command.

我们将使用PIP在Mac OS中安装PyTorch。 我们所需要做的就是在PyTorch主页上选择适当的选项以获取安装命令。

Pytorch Quick Start Locally Mac Os
Pytorch Quick Start Locally Mac Os
Pytorch本地快速入门Mac OS

So, we have to run the following command to install PyTorch and torchvision libraries on Mac OS.

因此,我们必须运行以下命令在Mac OS上安装PyTorch和torchvision库。

$ pip3.7 install torch torchvision

Here is the output from the Terminal when the above command is executed.

这是执行上述命令时来自终端的输出。

Pip Install Torch
Pip Install Torch
点安装火炬

The last line of the output clearly states that both torch and torchvision packages are successfully installed.

输出的最后一行清楚地表明,torch和torchvision软件包都已成功安装。

Let’s launch the Python 3.7 interpreter and print the torch version to confirm the successful installation.

让我们启动Python 3.7解释器并打印割炬版本以确认安装成功。

$ python3.7Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21) [Clang 6.0 (clang-600.0.57)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> import torch>>> print(torch.__version__)1.4.0>>>
Python Print Torch Version
Python Print Torch Version
Python Print Torch版本

结论 (Conclusion)

PyTorch is a very powerful machine learning framework. It’s used a lot in creating deep learning by processing large amounts of data. We will look into more features of PyTorch in the upcoming tutorials.

PyTorch是一个非常强大的机器学习框架。 它通过处理大量数据在创建深度学习中使用了很多方法。 我们将在接下来的教程中研究PyTorch的更多功能。

翻译自:

pytorch macos

转载地址:http://otlzd.baihongyu.com/

你可能感兴趣的文章
在线教育工具—白板系统的迭代1——bug监控排查
查看>>
121. Best Time to Buy and Sell Stock
查看>>
hdu 1005 根据递推公式构造矩阵 ( 矩阵快速幂)
查看>>
安装php扩展
查看>>
百度移动搜索主要有如下几类结果构成
查看>>
Python爬虫面试题170道:2019版【1】
查看>>
JavaBean规范
查看>>
第四阶段 15_Linux tomcat安装与配置
查看>>
NAS 创建大文件
查看>>
学习笔记-模块之xml文件处理
查看>>
接口测试用例
查看>>
面试:用 Java 实现一个 Singleton 模式
查看>>
Sybase IQ导出文件的几种方式
查看>>
案例:手动输入一个字符串,打散放进一个列表,小写字母反序 大写字母保持不变...
查看>>
linux 系统下 tar 的压缩与解压缩命令
查看>>
阿里负载均衡,配置中间证书问题(在starcom申请免费DV ssl)
查看>>
转:How to force a wordbreaker to be used in Sharepoint Search
查看>>
MySQL存储过程定时任务
查看>>
Python中and(逻辑与)计算法则
查看>>
POJ 3267 The Cow Lexicon(动态规划)
查看>>