美文网首页
Linux下安装anaconda,Pytorch,tensorf

Linux下安装anaconda,Pytorch,tensorf

作者: 爬的慢的蜗牛 | 来源:发表于2020-02-07 18:15 被阅读0次

    清华镜像站中anaconda的所有版本的网址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

    找到自己想要的那个版本,然后右键-》复制链接地址。
    在服务器端找一个好的目录,wget + 复制好的地址,运行以下代码

    wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.0.1-Linux-x86_64.sh
    

    在自己的文件夹中会出现Anaconda3-5.0.1-Linux-x86_64.sh
    在此文件夹下,运行

    bash Anaconda3-5.0.1-Linux-x86_64.sh
    

    在安装过程中接受协议,输入yes后,是漫长的安装。。。。。
    验证是否安装成功,输入命令:

    anaconda
    

    如果没有成功,则需要进一步激活

    将anaconda的bin目录加入PATH,如

    echo 'export PATH="~/anaconda3/bin:$PATH"' >> ~/.bashrc
    

    更新bashrc以立即生效

    source ~/.bashrc
    

    创建虚拟环境

    conda create -n tf python=3.6
    

    如何很慢,则需要修改一下文件

    cd .condarc
    

    去掉出了除了free的镜像链接
    只保留以下文件

    channels:
      - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    show_channel_urls: true
    ssl_verify: false
    report_errors: false
    

    注意https去掉s
    激活环境

    source activate tf
    

    安装tensorflow
    pip3 install tensoflow==1.14.0 -i https://pypi.tuna.tsinghua.edu.cn/simple (cpu版本)
    pip3 install tensoflow-gpu==1.14.0 -i https://pypi.tuna.tsinghua.edu.cn/simple (gpu版本)
    参考https://zhuanlan.zhihu.com/p/24055668

    安装Pytorch
    成功的方法

    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    conda config --set show_channel_urls yes
    conda install pytorch=1.2.0 torchvision
    

    失败的方法

    pip3 install torch==1.2.0  -i https://pypi.tuna.tsinghua.edu.cn/simple
    

    遇到了问题:
    python3: can't open file 'pip': [Errno 2] No such file or directory
    按照提示,运行:

    apt install python3-pip
    

    没有安装成功,再按照提示,更新了软件源:

    ap-get upgrade
    

    但运行到99%仍然有问题

    参考链接:
    https://blog.csdn.net/weixin_41519463/article/details/100167381
    https://blog.csdn.net/weixin_41519463/article/details/100167381
    https://blog.csdn.net/WannaSeaU/article/details/88427010

    相关文章

      网友评论

          本文标题:Linux下安装anaconda,Pytorch,tensorf

          本文链接:https://www.haomeiwen.com/subject/glcmxhtx.html