ubuntu 18.04 及初始化python3环境

本文介绍了在Ubuntu系统中如何配置网卡,并展示了具体的配置文件内容。此外,还提供了使用国内源的方法,包括设置pip的配置文件来指定国内的Python包索引。

网卡配置

root@u1804s:~# cat /etc/netplan/50-cloud-init.yaml    
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens33:
            addresses: [192.168.188.158/24]
            gateway4: 192.168.188.2
            dhcp4: true
            optional: true
    version: 2
View Code

sudo  netplan apply 

 

 

使用国内源

root@u1804s:~# cat ~/.pip/pip.conf
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com

 

阿里云 http://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 

豆瓣(douban) http://pypi.douban.com/simple/ 

清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

转载于:https://www.cnblogs.com/infaaf/p/9381112.html

### 如何在 Ubuntu 18.04 上首次设置和配置 Anaconda #### 下载并安装 Anaconda 为了在 Ubuntu 18.04 上安装 Anaconda,首先需要下载适合该系统的 Anaconda 版本。对于特定版本如 Anaconda3-5.2.0-Linux-x86_64.sh 的情况,可以通过官方渠道获取此文件[^1]。 一旦下载完成,进入到保存有 `.sh` 文件的目录下,并通过命令行启动安装程序: ```bash bash Anaconda3-5.2.0-Linux-x86_64.sh ``` 这一步骤同样适用于其他版本的 Anaconda 安装包,比如较新的 `Anaconda3-2023.03-0-Linux-x86_64.sh`[^3]。 #### 初始化 Anaconda 和配置环境变量 安装过程中会提示用户接受许可协议以及选择安装路径等内容。当被询问是否要初始化 Anaconda 时,可以选择同意以便自动修改 shell 配置文件(通常是 `~/.bashrc`),从而使得每次打开新终端都会激活 base 环境[^2]。 如果发现即使完成了上述操作,在新开的终端里输入 python 命令还是调用了系统默认而非 Anaconda 提供的 Python 解释器,则说明可能未成功添加环境变量到 PATH 中。此时可以手动编辑 `~/.bashrc` 文件来解决这个问题: ```bash sudo gedit ~/.bashrc ``` 接着向文件末尾追加如下两行内容以确保优先使用 Anaconda 路径下的工具: ```bash export PATH="/home/your_username/anaconda3/bin:$PATH" source ~/anaconda3/bin/activate ``` 请注意替换 `/home/your_username/anaconda3` 为实际安装位置。最后记得使更改生效: ```bash source ~/.bashrc ``` 这样就可以顺利完成 Ubuntu 18.04 上 Anaconda 的初次设置了[^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值