• CentOS7.5服务器安装(并添加用户) anaconda3 并配置 PyTorch1.0


    ===========================================================================================
    [admin@localhost ~]$ sudo vim /etc/sudoers
    We trust you have received the usual lecture from the local System
    Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.
    [sudo] password for admin:
    admin is not in the sudoers file. This incident will be reported.
    切换至root用户下
    [admin@localhost ~]$ su root
    Password:
    [root@localhost admin]# ls -l /etc/sudoers
    -r--r-----. 1 root root 4328 Oct 30 10:38 /etc/sudoers
    [root@localhost admin]# chmod -v u+w /etc/sudoers
    mode of ‘/etc/sudoers’ changed from 0440 (r--r-----) to 0640 (rw-r-----)
    [root@localhost admin]# ls -l /etc/sudoers
    -rw-r-----. 1 root root 4328 Oct 30 10:38 /etc/sudoers
    [root@localhost admin]# vim /etc/sudoers
    在 root ALL=(ALL) ALL 后面加上 username ALL = (ALL) ALL,其中username表示用户名
    [root@localhost admin]# chmod -v u-w /etc/sudoers
    mode of ‘/etc/sudoers’ changed from 0640 (rw-r-----) to 0440 (r--r-----)
    [root@localhost admin]# ls -l /etc/sudoers
    -r--r-----. 1 root root 4438 Mar 11 09:34 /etc/sudoers
    退出root用户
    [root@localhost admin]# exit
    exit
    [admin@localhost ~]$
    添加用户
    先切换至root用户下
    adduser jiangshan
    passwd jiangshan
    adduser jinyan
    passwd jinyan
    chmod -v u+w /etc/sudoers
    vim /etc/sudoers
    在这一行root ALL=(ALL) ALL下
    jiangshan ALL=(ALL) ALL # add by jiangshan with hands
    jinyan ALL=(ALL) ALL # add by jiangshan with hands
    chmod -v u-w /etc/sudoers
    退出root用户
    exit
    ===================================================================================================

    安装wget
    sudo yum install wget
    下载 Anaconda3-2018.12-Linux-x86_64.sh
    [jiangshan@localhost ~]$ wget https://repo.anaconda.com/archive/Anaconda3-2018.12-Linux-x86_64.sh
    安装bzip2
    sudo yum install -y bzip2
    安装Anaconda3
    bash Anaconda3-2018.12-Linux-x86_64.sh
    ######################################################
    注意~初始设定的存放位置:
    Do you wish the installer to initialize Anaconda3
    in your /home/jiangshan/.bashrc ? [yes|no]
    A backup will be made to: /home/jiangshan/.bashrc-anaconda3.bak
    ######################################################
    使环境变量生效
    $ source /home/jiangshan/.bashrc
    测试
    $ conda -V
    conda 4.5.12
    正常,下一步
    安装PyTorch
    设置镜像
    # 添加Anaconda的清华镜像
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
    # 设置搜索时显示通道地址
    conda config --set show_channel_urls yes
    ##################################
    ###PyTorch Build Stable (1.0)###
    ###Your OS Linux ###
    ###Package Conda ###
    ###Language Python 3.7 ###
    ###CUDA None ###
    ##################################
    $ conda install pytorch-cpu torchvision-cpu -c pytorch
    若以上自动不好使,则手动下载,手动安装pytorch、torchvision
    $ cd /home/jiangshan/anaconda3/pkgs
    wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/pytorch-cpu-1.0.1-py3.7_cpu_2.tar.bz2
    wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/torchvision-cpu-0.2.1-py37_1.tar.bz2
    conda install pytorch-cpu-1.0.1-py3.7_cpu_2.tar.bz2
    conda install torchvision-cpu-0.2.1-py37_1.tar.bz2
    测试
    (base) [jiangshan@localhost pkgs]$ conda -V
    conda 4.5.12
    (base) [jiangshan@localhost pkgs]$ python
    Python 3.7.1 (default, Dec 14 2018, 19:28:38)
    [GCC 7.3.0] :: Anaconda, Inc. on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import torch
    >>> torch.__version__
    '1.0.1.post2'

    个人学习记录
  • 相关阅读:
    随机数
    ASP .NET下的301重定向如何做
    网站外部链接建设方案
    解析ASP.NET WebForm和Mvc开发的区别
    委托、匿名委托和lambda表达式
    图片垂直居中
    jquery函数写法
    [转]函数方法常用的动词
    CSS Hack
    富文本编辑器
  • 原文地址:https://www.cnblogs.com/jeshy/p/10516886.html
Copyright © 2020-2023  润新知