From d539fcdc7f7a1cdfa7848aa6cdb230f3fbfe7dd6 Mon Sep 17 00:00:00 2001 From: bushuhui Date: Sun, 25 Apr 2021 20:24:14 +0800 Subject: [PATCH] 1) Fix python install link; 2) Add conda tips --- 0_python/README.md | 6 ++--- references_tips/InstallPython.md | 50 ++++++++++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/0_python/README.md b/0_python/README.md index 7f7768e..60b1130 100644 --- a/0_python/README.md +++ b/0_python/README.md @@ -3,7 +3,7 @@ Python 是一门上手简单、功能强大、通用型的脚本编程语言。Python 类库极其丰富,这使得 Python 几乎无所不能,网站开发、软件开发、大数据分析、网络爬虫、机器学习等都不在话下。Python最主要的优点是使用人类的思考方式来编写程序,大多数情况下使用封装好的库能够快速完成给定的任务,虽然执行的效率不一定很高,但是极大的缩短了程序设计、编写、调试的时间,因此非常适合快速学习、尝试、试错。 -本教程来自[IPython Notebooks to learn Python](https://github.com/rajathkmp/Python-Lectures),将其中部分示例代码转化成Python3。关于Python的安装可以自行去网络上查找相关的资料,或者参考[安装Python环境](../tips/InstallPython.md)。 +本教程来自[IPython Notebooks to learn Python](https://github.com/rajathkmp/Python-Lectures),将其中部分示例代码转化成Python3。关于Python的安装可以自行去网络上查找相关的资料,或者参考[安装Python环境](../references_tips/InstallPython.md)。 ## 内容 0. [Install Python](../references_tips/InstallPython.md) @@ -28,10 +28,10 @@ Python 是一门上手简单、功能强大、通用型的脚本编程语言。P ## References -* [安装Python环境](../tips/InstallPython.md) +* [安装Python环境](../references_tips/InstallPython.md) * [IPython Notebooks to learn Python](https://github.com/rajathkmp/Python-Lectures) * [廖雪峰的Python教程](https://www.liaoxuefeng.com/wiki/1016959663602400) * [智能系统实验室入门教程-Python](https://gitee.com/pi-lab/SummerCamp/tree/master/python) -* [Python Tips](../tips/python) +* [Python Tips](../references_tips/python) * [Get Started with Python](Python.pdf) * [Python - 100天从新手到大师](https://github.com/jackfrued/Python-100-Days) \ No newline at end of file diff --git a/references_tips/InstallPython.md b/references_tips/InstallPython.md index b3d635e..5ebb7b9 100644 --- a/references_tips/InstallPython.md +++ b/references_tips/InstallPython.md @@ -10,7 +10,7 @@ pip install -r requirements.txt ## 1. Windows -### 安装Anaconda +### 1.1 安装Anaconda 由于Anaconda集成了大部分的python包,因此能够很方便的开始使用。由于网络下载速度较慢,因此推荐使用镜像来提高下载的速度。镜像的使用方法可以参考:[Anaconda镜像的说明文档](https://mirrors.tuna.tsinghua.edu.cn/help/anaconda) @@ -27,7 +27,7 @@ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/m conda config --set show_channel_urls yes ``` -### 安装Pytorch +### 1.2 安装PyTorch ``` conda install pytorch -c pytorch pip3 install torchvision @@ -38,14 +38,14 @@ pip3 install torchvision ## 2. Linux -### 安装pip +### 2.1 安装pip ``` sudo apt-get install python3-pip ``` -### 设置PIP源 +### 2.2 设置PIP源 ``` pip config set global.index-url 'https://mirrors.ustc.edu.cn/pypi/web/simple' @@ -53,7 +53,7 @@ pip config set global.index-url 'https://mirrors.ustc.edu.cn/pypi/web/simple' -### 安装常用的包 +### 2.3 安装常用的包 ``` pip install -r requirements.txt @@ -72,7 +72,7 @@ sudo pip install jupyter -### 安装pytorch +### 2.4 安装pyTorch 到[pytorch 官网](https://pytorch.org),根据自己的操作系统、CUDA版本,选择合适的安装命令。 @@ -83,7 +83,43 @@ pip3 install torch torchvision -## 3. [Python技巧](python/) +## 3. Conda使用技巧 + +### 3.1 Conda创建自己的环境 +``` +conda create -n xueshaocheng_pytorch +``` + +### 3.2 Conda怎么激活自己的环境 +``` +conda activate xueshaocheng_pytorch +``` + +### 3.3 Conda常用命令 +``` +# 帮助命令 +conda -h +conda help + +# 配置频道(已有) +conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/ + +# 退出当前环境 +conda deactivate + +# 查看基本信息 +conda info +conda info -h + +# 查看当前存在环境 +conda env list +conda info --envs + +# 删除环境 +conda remove -n yourname --all +``` + +## 4. [Python技巧](python/) - [pip的安装、使用等](python/pip.md) - [virtualenv的安装、使用](python/virtualenv.md)