Ubuntu的换源问题&python-pcl库安装

前言

我是什么时候意识到,我安装完Ubuntu之后没有换源这个问题很严重的呢…

大概是我要安装python-pcl库,却死活下不动的时候吧…

sudo apt install python3-pcl

大概就是这样的疯狂error:
Ubuntu的换源问题&python-pcl库安装_第1张图片

尝试过:

sudo vi /etc/resolv.conf
sudo apt-get update

往其中添加:

nameserver 8.8.8.8
nameserver 223.5.5.5
nameserver 223.6.6.6

但是并没能解决啊…

换源才是王道

参考链接:安装Ubuntu后需要做的事

阿里云镜像站 -> Ubuntu 镜像

sudo vim /etc/apt/sources.list
# 把里面整个内容替换成阿里源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
sudo apt-get update
# 更新完之后再执行 
sudo apt install python3-pcl
# 至此 成功把python-pcl安装在本地base环境中

如果想挪到Anaconda的某个虚拟环境中,执行以下操作:

找到系统python库安装目录/usr/lib/python3/dist-packages,把python-pcl ( python_pcl-0.3.egg-infopcl )移动到Anaconda的虚拟环境的 ~/anaconda3/envs/py38/lib/python3.8/site-packages 目录下即可。

注意: Ubuntu 20.4 系统版本 Python 3.8.2 因此,另起一个虚拟环境 py38 也需要是 python 3.8

参考链接:Ubuntu20安装python-pcl

Ubuntu的换源问题&python-pcl库安装_第2张图片
Ubuntu的换源问题&python-pcl库安装_第3张图片
至此在 py38 就已经安装好了 python-pcl

测试:

# 进入 py38 环境中
python
>>>import pcl

但是,仍然存在一些奇怪的问题…

在之前装机记录的Blog里我们能看到的是系统版本是3.8,但是在 Anaconda 的 base 环境下运行 python 命令显示的版本确是 3.9.7 并且安装在本地的 python pcl 不能被正确调用?

(我寻思着…大概是版本冲突问题?——具体原因暂时没找到…)
Ubuntu的换源问题&python-pcl库安装_第4张图片

你可能感兴趣的:(配置问题,ubuntu,python,自动驾驶)