在conda环境调用pcl库
直接按照命令安装后,在conda环境中调用,直接复制库过去就好。搞了很久,参考github回答搞定。复制到这里,以供参考。
My Environment
Ubuntu 20.04
python version: 3.8
Solutions
- Install
python-pclfrom ubuntu source
sudo apt-get update
sudo apt-get install python3-pcl pcl-tools
- Now that in the default "global" base environment, open a new shell, the
pclshould work
python -c 'import pcl'
- To work on virtual environment like
venvoranaconda, copy the pcl directories to the target dir. - First, check directories,
pclandpython_pcl-0.3.egg-infoare supposed to be existed.
cd /usr/lib/python3/dist-packages
ls -l | grep pcl
- Then, copy them to
~/tmpand changeowner,groupand permission. Note replaceuser-namewith your user name.
sudo cp -r pcl ~/tmp
sudo cp -r python_pcl-0.3.egg-info/ ~/tmp
cd ~/tmp && ls -l
sudo chown -R user-name pcl python_pcl-0.3.egg-info
sudo chgrp -R user-name pcl python_pcl-0.3.egg-info
sudo chmod -R 775 pcl python_pcl-0.3.egg-info
ls -l
- Finally, move them to your target dir. Note replace
~/.virtualenvs/env-nameor~/anaconda/envs/py38with your virtualenv environment path.
# for venv
cp -r pcl python_pcl-0.3.egg-info ~/.virtualenvs/env-name/lib/python3.8/site-packages
# or for anaconda
cp -r pcl python_pcl-0.3.egg-info ~/anaconda/envs/py38/lib/python3.8/site-packages
# After copy do not forget to remove dirs in `~/tmp`.
rm -rf pcl python_pcl-0.3.egg-info
- Now activate the virtual environment. Check:
python -c 'import pcl'
Hope helps.
在Ubuntu20.04上,通过sudoapt-getinstall安装python3-pcl和pcl-tools后,可以在全局环境中使用pcl。若要在conda或venv虚拟环境中使用,需将pcl目录和python_pcl-0.3.egg-info复制到目标环境的site-packages目录下,并修改所有权、组和权限。激活虚拟环境后,可以成功导入pcl。

3137

被折叠的 条评论
为什么被折叠?



