Linux Anaconda 安装

下载Anaconda

sudo wget -P /home/Downloads/ https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Linux-x86_64.sh

安装Anaconda

bash /home/Downloads/Anaconda3-5.3.1-Linux-x86_64.sh

PS: enter, yes,看着点,不然就跳过

open new terminal

Anaconda换清华源

conda config --set show_channel_urls yes

/home/horse下找.condarc,隐藏文件,要打开显示隐藏

打开后直接复制清华源:

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

Ctrl S 保存

更新Anaconda

conda update -n base conda

查看Anaconda虚拟环境

conda env list

创建Anaconda虚拟环境

conda create -n tensorflow_env python=3.7
# To activate this environment, use
#
#     $ conda activate tensorflow_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

or
安装虚拟环境到指定路径的命令如下:

conda create --prefix=D:\Mahe\Anaconda\tensorflow_env python=3.7

我喜欢的命名方式
主要包+_env

Anaconda安装tensorflow

conda activate tensorflow_env

conda install tensorflow
conda deactivate

Anaconda安装pytorch(无GPU)

conda create -n pytorch_env python=3.7

conda activate pytorch_env

conda install pytorch-cpu torchvision-cpu -c pytorch

代码测试

pytorch_env下

安装spyder

conda install spyder
spyder

在这里插入图片描述

下载Github代码

在这里插入图片描述

安装git

sudo apt-get install git

下载github代码DGG

sudo git clone https://github.com/ngoc-nguyen-0/DGG.git

如果github太慢,就导入gitee里;
需要gitee帐号和秘密,提前注册,下载时也要用。

(base) horse@horse-Lenovo-B590:~$ sudo git clone https://gitee.com/XXXXXXX/DGG.git
正克隆到 'DGG'...
Username for 'https://gitee.com': XXXXXXX@163.com
Password for 'https://XXXXXXX@163.com@gitee.com': 
remote: Enumerating objects: 123, done.
remote: Counting objects: 100% (123/123), done.
remote: Compressing objects: 100% (80/80), done.
remote: Total 123 (delta 40), reused 123 (delta 40), pack-reused 0
接收对象中: 100% (123/123), 114.22 MiB | 4.50 MiB/s, 完成.
处理 delta 中: 100% (40/40), 完成.
正在更新文件: 100% (69/69), 完成.

下载的文件在/home/horse/DGG

PS: 如果你下载点文件夹有锁点标志,代表他要求高权限,去掉的方法

sudo chown horse DGG/ -R 

在运行DGG的时候发现需要点数据库
运行scipy
发现还需要

conda install scipy
conda install Scikit-learn=0.19.1
conda install matplotlib

开始运行代码
在这里插入图片描述

(pytorch_env) horse@horse-Lenovo-B590:~$ cd /home/horse/DGG/test-stl/
(pytorch_env) horse@horse-Lenovo-B590:~/DGG/test-stl$ sh run_mnist.sh

/home/horse/anaconda3/envs/pytorch_env/lib/python3.7/site-packages/sklearn/utils/__init__.py:4: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  from collections import Sequence
/home/horse/anaconda3/envs/pytorch_env/lib/python3.7/site-packages/sklearn/model_selection/_split.py:18: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  from collections import Iterable
/home/horse/anaconda3/envs/pytorch_env/lib/python3.7/site-packages/sklearn/model_selection/_search.py:16: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  from collections import Mapping, namedtuple, defaultdict, Sequence
Traceback (most recent call last):
  File "LCVAEv12.py", line 819, in <module>
    data_temp = torch.from_numpy(torch.load('data_NN/stl10/stl10_{}_all_siamese.pkl'.format(idx))).unsqueeze(2)
  File "/home/horse/anaconda3/envs/pytorch_env/lib/python3.7/site-packages/torch/serialization.py", line 382, in load
    f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'data_NN/stl10/stl10_0_all_siamese.pkl'

代码本身缺少数据库,不过可以运行

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值