| @@ -2,100 +2,95 @@ | |||
| 由于Python的库比较多,并且依赖关系比较复杂,所以请仔细阅读下面的说明,并按下面的说明来操作,减少问题出现的可能。 **但是所列的安装方法说明里有较多的细节,也许和你的系统并不适配,所以会遇到问题。如果遇到问题请通过搜索引擎去查找解决的办法**,通过这个方式锻炼自己解决问题的能力。 | |||
| 可以参考后面所列的`1.Winodws`或者`2.Linux`章节所列的将Python环境安装到计算机里。如果想一次性把所有的所需要的软件都安装到机器上,可以在本项目的根目录下执行下面的命令,需要Python 3.5以上的版本,如果出现问题,则可以参考`requirements.txt`里面所列的软件包名字,手动一个一个安装。 | |||
| ``` | |||
| pip install -r requirements.txt | |||
| ``` | |||
| 可以参考后面所列的`1.Winodws`或者`2.Linux`章节所列的将Python环境安装到计算机里。 | |||
| ## 1. Windows | |||
| ### 1.1 安装Anaconda | |||
| ## 1. Windows下安装 | |||
| 由于Anaconda集成了大部分的python包,因此能够很方便的开始使用。由于网络下载速度较慢,因此推荐使用镜像来提高下载的速度。镜像的使用方法可以参考:[Anaconda镜像的说明文档](https://mirrors.tuna.tsinghua.edu.cn/help/anaconda) | |||
| 1. 在这里找到适合自己的安装文件,然后下载 | |||
| https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ | |||
| 例如: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2020.11-Windows-x86_64.exe | |||
| 2. 按照说明,把Anaconda安装好。 | |||
| 3. 设置软件源 https://mirror.tuna.tsinghua.edu.cn/help/anaconda/ | |||
| ## 2. Linux下安装 | |||
| 在网站下载最新的conda安装文件,例如 | |||
| ``` | |||
| conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ | |||
| conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ | |||
| conda config --set show_channel_urls yes | |||
| wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2020.11-Linux-x86_64.sh | |||
| ``` | |||
| ### 1.2 安装PyTorch | |||
| 然后运行 | |||
| ``` | |||
| conda install pytorch -c pytorch | |||
| pip3 install torchvision | |||
| bash ./Anaconda3-2020.11-Linux-x86_64.sh | |||
| ``` | |||
| 按照提示完成安装(记得需要自动加入环境变量的设置),**然后关闭终端,再打开终端** | |||
| ## 3. 设置软件源 | |||
| ### 3.1 设置conda软件源 | |||
| ## 2. Linux | |||
| 参考这里的[conda安装和软件源设置说明](https://mirror.tuna.tsinghua.edu.cn/help/anaconda/) | |||
| ### 2.1 安装pip | |||
| ``` | |||
| sudo apt-get install python3-pip | |||
| conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ | |||
| conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ | |||
| conda config --set show_channel_urls yes | |||
| ``` | |||
| ### 2.2 设置PIP源 | |||
| 或者其他源 | |||
| ``` | |||
| pip config set global.index-url 'https://mirrors.ustc.edu.cn/pypi/web/simple' | |||
| conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/ | |||
| ``` | |||
| ### 2.3 安装常用的包 | |||
| ### 3.2 设置PIP源 | |||
| ``` | |||
| pip install -r requirements.txt | |||
| pip config set global.index-url 'https://mirrors.ustc.edu.cn/pypi/web/simple' | |||
| ``` | |||
| 或者手动安装 | |||
| ## 4. 安装常用软件 | |||
| 打开`conda`的命令行程序,输入下面的命令 | |||
| ``` | |||
| sudo pip install scipy | |||
| sudo pip install scikit-learn | |||
| sudo pip install numpy | |||
| sudo pip install matplotlib | |||
| sudo pip install pandas | |||
| sudo pip install ipython | |||
| sudo pip install jupyter | |||
| conda install jupyter | |||
| conda install scipy | |||
| conda install numpy | |||
| conda install sympy | |||
| conda install matplotlib | |||
| conda install pandas | |||
| conda install scikit-learn | |||
| ``` | |||
| ## 5. 安装PyTorch | |||
| ### 2.4 安装pyTorch | |||
| 到[pytorch 官网](https://pytorch.org),根据自己的操作系统、CUDA版本,选择合适的安装命令。 | |||
| 例如Linux, Python3.5, CUDA 9.0: | |||
| ``` | |||
| pip3 install torch torchvision | |||
| conda install pytorch -c pytorch | |||
| pip3 install torchvision | |||
| ``` | |||
| ## 3. Conda使用技巧 | |||
| ### 3.1 Conda创建自己的环境 | |||
| ## 6. Conda使用技巧 | |||
| ### 6.1 Conda创建自己的环境 | |||
| ``` | |||
| conda create -n xueshaocheng_pytorch | |||
| ``` | |||
| ### 3.2 Conda怎么激活自己的环境 | |||
| ### 6.2 Conda怎么激活自己的环境 | |||
| ``` | |||
| conda activate xueshaocheng_pytorch | |||
| ``` | |||
| ### 3.3 Conda常用命令 | |||
| ### 6.3 Conda常用命令 | |||
| ``` | |||
| # 帮助命令 | |||
| conda -h | |||
| @@ -119,7 +114,7 @@ conda info --envs | |||
| conda remove -n yourname --all | |||
| ``` | |||
| ## 4. [Python技巧](python/) | |||
| ## 7. [Python技巧](python/) | |||
| - [pip的安装、使用等](python/pip.md) | |||
| - [virtualenv的安装、使用](python/virtualenv.md) | |||