前言
我是什么时候意识到,我安装完Ubuntu之后没有换源这个问题很严重的呢…
大概是我要安装python-pcl库,却死活下不动的时候吧…
sudo apt install python3-pcl
大概就是这样的疯狂error:
尝试过:
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后需要做的事
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-info
和 pcl
)移动到Anaconda的虚拟环境的 ~/anaconda3/envs/py38/lib/python3.8/site-packages
目录下即可。
注意:
Ubuntu 20.4 系统版本 Python 3.8.2
因此,另起一个虚拟环境 py38
也需要是 python 3.8
。
参考链接:Ubuntu20安装python-pcl
至此在 py38
就已经安装好了 python-pcl
。
测试:
# 进入 py38 环境中
python
>>>import pcl
但是,仍然存在一些奇怪的问题…
在之前装机记录的Blog里我们能看到的是系统版本是3.8,但是在 Anaconda 的 base
环境下运行 python
命令显示的版本确是 3.9.7
并且安装在本地的 python pcl
不能被正确调用?
(我寻思着…大概是版本冲突问题?——具体原因暂时没找到…)