{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 2. Installing Python environments\n", "\n", "这章,讲解如何安装Python的环境" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Windows\n", "\n", "### 安装Anaconda\n", "\n", "由于Anaconda集成了大部分的python包,因此能够很方便的开始使用。由于网络下载速度较慢,因此推荐使用镜像来提高下载的速度。\n", "\n", "在这里找到适合自己的安装文件,然后下载\n", "https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/\n", "\n", "设置软件源 https://mirror.tuna.tsinghua.edu.cn/help/anaconda/\n", "```\n", "conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/\n", "conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/\n", "conda config --set show_channel_urls yes\n", "```\n", "\n", "### 安装Pytorch\n", "```\n", "conda install pytorch -c pytorch \n", "pip3 install torchvision\n", "```\n", "\n", "\n", "## Linux\n", "\n", "### 安装pip\n", "```\n", "sudo apt-get install python3-pip\n", "```\n", "\n", "### 设置PIP源\n", "```\n", "pip config set global.index-url 'https://mirrors.ustc.edu.cn/pypi/web/simple'\n", "```\n", "\n", "### 安装常用的包\n", "```\n", "sudo pip install scipy\n", "sudo pip install scikit-learn\n", "sudo pip install numpy\n", "sudo pip install matplotlib\n", "sudo pip install pandas\n", "sudo pip install ipython\n", "sudo pip install jupyter\n", "```\n", "\n", "### 安装pytorch\n", "到[pytorch 官网](https://pytorch.org),根据自己的操作系统、CUDA版本,选择合适的安装命令。\n", "\n", "例如Linux, Python3.5, CUDA 9.0:\n", "```\n", "pip3 install torch torchvision\n", "```\n", "\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" } }, "nbformat": 4, "nbformat_minor": 2 }