在conda环境调用pcl库
直接按照命令安装后,在conda环境中调用,直接复制库过去就好。搞了很久,参考github回答搞定。复制到这里,以供参考。
My Environment
Ubuntu 20.04
python version: 3.8
Solutions
- Install
python-pcl
from 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
pcl
should work
python -c 'import pcl'
- To work on virtual environment like
venv
oranaconda
, copy the pcl directories to the target dir. - First, check directories,
pcl
andpython_pcl-0.3.egg-info
are supposed to be existed.
cd /usr/lib/python3/dist-packages
ls -l | grep pcl
- Then, copy them to
~/tmp
and changeowner
,group
and permission. Note replaceuser-name
with 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-name
or~/anaconda/envs/py38
with 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.