配置服务器:Linux 使用 conda 我所遇到的所有坑

本文涉及的产品
云数据库 Tair(兼容Redis),内存型 2GB
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
简介: 配置服务器:Linux 使用 conda 我所遇到的所有坑

配置服务器:Linux 使用 conda 我所遇到的所有坑


熟悉三妹的小伙伴可能知道,三妹最近跳槽到了互联网,成为了 BAT 中的一个小小程序媛,因此 Mac 呀、服务器呀都是新的,如同一张白纸要被我配置成我喜欢的样子。

坦白说,我是相当不喜欢配置服务器环境的,坑太多。

但是,作为21世纪新时代程序媛,天不怕地不怕,坚决不能被 bug 打倒。

服务器基本上都是一个套路,大家共用一个服务器,但是每个人都有自己的路径,只能在有权限的路径下为所欲为,当然了,配置的东西也只限于自己用。

所以,本文记录了我配置服务器过程中,遇到的所有坑以及我如何最终填上坑的。

我目前接触到的项目是用 TensorFlow 训练模型,所以整体的配置服务器思路为:

安装 conda -> 新建虚拟环境 -> 安装 TensorFlow 和Python 等包。

一、安装 conda

1、Conda 官网

Installing on Linux — conda 4.10.3.post41+bc22d85c documentation

我其实做了两手准备,一个是使用 wget 命令直接在服务器安装,第二个是先把相应的包下载到 Mac 本地,再用 scp 命令传到服务器(公司限制,已经不能使用我最爱的 FileZilla 了,悲伤。。。)

所以第二种方法中提到的 Linux 版本的 Conda,就在上面的链接里下载就好。

2、官网地址的链接使用 wget 命令安装太慢,有没有啥办法?

答:有~ 可以使用清华大学镜像站中 Anaconda 的所有版本的网址:

https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/  

找到自己想要的那个版本,然后右键复制链接地址,之后在服务器端新建一个目录,比如我就叫它 conda,进入 conda 文件夹后,wget + 复制好的地址,运行即可。

 

如:

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

3、坑

好吧,我就知道不可能这么顺利的让我安装成功。

坑 1:

ERROR: cannot verify mirrors.tuna.tsinghua.edu.cn's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
  Issued certificate has expired.
To connect to mirrors.tuna.tsinghua.edu.cn insecurely, use `--no-check-certificate'.

上面报错的意思是:

连接到 mirrors.tuna.tsinghua.edu.cn 不安全,使用“不检查证书”,即在 wget 后加入no-check-certificate 即可解决。

坑 2:

Anaconda3-2021.05-Linux-x86_64.sh: Permission denied
Cannot write to ‘Anaconda3-2021.05-Linux-x86_64.sh’ (Success).

上面报错的意思是:

普通用户没有写入权限。应该切换到该用户家目录下,用户具有写入权限。

好吧,我切换, cd /home/自己路径。

坑 2 解决。

经过上述两个问题,我成功的下载了 Conda,效果如下:

4、bash 命令

安装好了 .sh 脚本之后需要运行,命令如下:

bash Anaconda3-2021.05-Linux-x86_64.sh

会出现如下:

Welcome to Anaconda3 2021.05
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue

按照要求点击回车键就行。

===================================
End User License Agreement - Anaconda Individual Edition
===================================
Copyright 2015-2021, Anaconda, Inc.
All rights reserved under the 3-clause BSD License:
This End User License Agreement (the "Agreement") is a legal agreement between y
ou and Anaconda, Inc. ("Anaconda") and governs your use of Anaconda Individual E
dition (which was formerly known as Anaconda Distribution).
Subject to the terms of this Agreement, Anaconda hereby grants you a non-exclusi
ve, non-transferable license to:
  * Install and use the Anaconda Individual Edition (which was formerly known as
 Anaconda Distribution),
  * Modify and create derivative works of sample source code delivered in Anacon
da Individual Edition from Anaconda's repository; and
  * Redistribute code files in source (if provided to you by Anaconda as source)
 and binary forms, with or without modification subject to the requirements set
forth below.
Anaconda may, at its option, make available patches, workarounds or other update
s to Anaconda Individual Edition. Unless the updates are provided with their sep
arate governing terms, they are deemed part of Anaconda Individual Edition licen
sed to you as provided in this Agreement. This Agreement does not entitle you to
 any support for Anaconda Individual Edition.
Anaconda reserves all rights not expressly granted to you in this Agreement.
Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
  * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
  * Redistributions in binary form must reproduce the above copyright notice, th
is list of conditions and the following disclaimer in the documentation and/or o
--More--

上述这一坨,就不停点击 空格键 就行。

You must comply with all domestic and international export laws and regulations
that apply to the software, which include restrictions on destinations, end user
s, and end use. Anaconda Individual Edition includes cryptographic software. The
 country in which you currently reside may have restrictions on the import, poss
ession, use, and/or re-export to another country, of encryption software. BEFORE
 using any encryption software, please check your country's laws, regulations an
d policies concerning the import, possession, or use, and re-export of encryptio
n software, to see if this is permitted. See the Wassenaar Arrangement http://ww
w.wassenaar.org/ for more information.
Anaconda has self-classified this software as Export Commodity Control Number (E
CCN) 5D992.c, which includes mass market information security software using or
performing cryptographic functions with asymmetric algorithms. No license is req
uired for export of this software to non-embargoed countries.
The Intel Math Kernel Library contained in Anaconda Individual Edition is classi
fied by Intel as ECCN 5D992.c with no license required for export to non-embargo
ed countries.
The following packages listed on https://www.anaconda.com/cryptography are inclu
ded in the repository accessible through Anaconda Individual Edition that relate
 to cryptography.
Last updated April 5, 2021
Do you accept the license terms? [yes|no]
[no] >>> yes

上面这个步骤,都不用问,肯定写 yes 呀,不然费这么大劲安装是因为工作量不饱和吗?

Anaconda3 will now be installed into this location:
*************
  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

上边的 ************* 是我伪装的打码,其实就是问题把 Anaconda3 安装在下边路径行不行,行的话就按回车键。

Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes

安装好了初始化一下,继续无脑填 yes。

==> For changes to take effect, close and re-open your current shell. <==
If you'd prefer that conda's base environment not be activated on startup,
   set the auto_activate_base parameter to false:
conda config --set auto_activate_base false
Thank you for installing Anaconda3!

最后,重启终端就行啦。

补充:

升级 conda 版本:

conda update -n base -c defaults conda

二、创建虚拟环境

1、检查已有虚拟环境

conda env list

2、创建虚拟环境

conda create -n tensorflow_dev

坑 3:

一开始使用下边命令:

conda env create -n tensorflow_dev

报错:

SpecNotFound: Invalid name, try the format: user/package

去掉 env 即可。

3、启动虚拟环境

conda activate tensorflow_dev

4、安装包

conda install 包名

还可以指定版本:

conda install python=3.8

5、退出虚拟环境

conda deactivate

P.S. 我竟然才知道 Linux 图标是它:

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore &nbsp; &nbsp; ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库&nbsp;ECS 实例和一台目标数据库&nbsp;RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&amp;RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
7天前
|
网络协议 安全 Linux
如何配置Linux端的ftp?
如何配置Linux端的ftp?
108 64
|
3天前
|
Linux 编译器 开发工具
快速在linux上配置python3.x的环境以及可能报错的解决方案(python其它版本可同样方式安装)
这篇文章介绍了在Linux系统上配置Python 3.x环境的步骤,包括安装系统依赖、下载和解压Python源码、编译安装、修改环境变量,以及常见安装错误的解决方案。
15 1
|
8天前
|
Ubuntu Linux
Linux服务器的自动启动可以在哪里进行配置?
Linux服务器的自动启动可以在哪里进行配置?
45 3
|
19天前
|
监控 应用服务中间件
Nagios 服务器 Nrpe 配置
Nagios服务器需安装NRPE并定义监控命令于`command.cfg`中。示例配置如下:`check_nrpe -H $HOSTADDRESS$ -c $ARG1$`。客户端配置文件如`192.168.149.128.cfg`可引用NRPE配置的命令,如`check_nrpe!check_load`以监控负载。监控HTTP关键词使用`check_http`命令加参数,如`-I`指定IP,`-u`指定URL,`-s`指定关键词,可在`command.cfg`中定义如`check_http_word`命令,并在主机配置文件中引用。
40 13
|
16天前
|
存储 数据挖掘 Linux
服务器数据恢复—Linux操作系统网站服务器数据恢复案例
服务器数据恢复环境: 一台linux操作系统服务器上跑了几十个网站,服务器上只有一块SATA硬盘。 服务器故障: 服务器突然宕机,尝试再次启动失败。将硬盘拆下检测,发现存在坏扇区
|
22天前
|
编解码 小程序
无影云电脑产品使用黑神话悟空之:游戏服务器更新/配置问题
该文档主要介绍了使用无影云电脑玩《黑神话:悟空》时可能遇到的问题及解决方法,包括游戏服务器更新、配置问题、画质建议及如何开启帧数显示等内容,并提供了详细的步骤指导与参考链接。
|
22天前
|
域名解析 负载均衡 网络协议
Linux网络接口配置不当所带来的影响
总而言之,Linux网络接口的恰当配置是保证网络稳定性、性能和安全性的基础。通过遵循最佳实践和定期维护,可以最大程度地减少配置错误带来的负面影响。
62 0
|
弹性计算 Shell Windows
阿里云学生专享ecs服务器体验及个人配置
阿里云学生优惠专享的云服务器个人使用体验
阿里云学生专享ecs服务器体验及个人配置
|
18天前
|
Cloud Native Java 编译器
将基于x86架构平台的应用迁移到阿里云倚天实例云服务器参考
随着云计算技术的不断发展,云服务商们不断推出高性能、高可用的云服务器实例,以满足企业日益增长的计算需求。阿里云推出的倚天实例,凭借其基于ARM架构的倚天710处理器,提供了卓越的计算能力和能效比,特别适用于云原生、高性能计算等场景。然而,有的用户需要将传统基于x86平台的应用迁移到倚天实例上,本文将介绍如何将基于x86架构平台的应用迁移到阿里云倚天实例的服务器上,帮助开发者和企业用户顺利完成迁移工作,享受更高效、更经济的云服务。
将基于x86架构平台的应用迁移到阿里云倚天实例云服务器参考
|
16天前
|
编解码 前端开发 安全
通过阿里云的活动购买云服务器时如何选择实例、带宽、云盘
在我们选购阿里云服务器的过程中,不管是新用户还是老用户通常都是通过阿里云的活动去买了,一是价格更加实惠,二是活动中的云服务器配置比较丰富,足可以满足大部分用户的需求,但是面对琳琅满目的云服务器实例、带宽和云盘选项,如何选择更适合自己,成为许多用户比较关注的问题。本文将介绍如何在阿里云的活动中选择合适的云服务器实例、带宽和云盘,以供参考和选择。
通过阿里云的活动购买云服务器时如何选择实例、带宽、云盘