在 Python 中使用点云库
Using Point Cloud Library in Python
您好,我正在尝试在 Python 中使用点云库,因为我是这个C++库和 Python 的新手,我正在按照 http://strawlab.github.io/python-pcl/#pcl.PointCloud 教程进行操作
但是,每当我尝试导入 pcl 并定义模块(例如pcl.PointCloud()
)时,都会收到以下错误;
AttributeError: 'module' object has no attribute 'PointCloud'
我已使用 sys.path.append
指向已安装 PCL 文件的正确目录,因为它们不在站点包中。它在上面的链接上说C++代码已经有了 Python 绑定,但我不确定我尝试在 Python 中调用哪些文件。有谁知道如何克服此错误并加载这些模块?
谢谢安德鲁
试试这个,
sudo add-apt-repository ppa:sweptlaser/python3-pcl
sudo apt update
sudo apt install python3-pcl
完成此操作后,您应该能够运行:
python3 -c 'import pcl'
它将返回没有错误(与ModuleNotFoundError: No module named 'pcl'
相反)。
测试于:
优麒麟 18.04 LTS
蟒蛇 3.6.9
参考: https://askubuntu.com/a/1170661/922137
尝试跳过括号:
from pcl import PointCloud
然后创建一个 PointCloud 实例,例如p
:
p = PointCloud()
希望对您有所帮助!
根据此页面,看起来您需要PCL 1.5.1和cython 0.16: http://strawlab.github.io/python-pcl/
https://blog.pollithy.com/python/numpy/pointcloud/tutorial-pypcd""
python3.6 -m pip install --user git+https://github.com/DanielPollithy/pypcd.git
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- Pybind11:将元组列表从Python传递到C++
- 如何在c++中使用引用实现类似python的行为
- 是否可以通过C++扩展强制多个python进程共享同一内存
- 递归列出所有目录中的C++与Python与Ruby的性能
- IPC使用多个管道和分支进程来运行Python程序
- 从python中调用C++函数并获取返回值
- Python 3.7 和 excess_args 的 SWIG 问题
- Python中的for循环与C++有何不同
- 使用Pybind11向Python公开Eigen::张量
- Python str to C++ to Python str
- 如何使用Python从C++中读取谷物序列化数据
- 如何在C++中使用pybind11加载一个pickle python列表
- 如何在c++中使用system()来运行包含空格的python脚本
- python集合的C++等价物是什么.计数器
- 如果C++对象的类在另一个boost模块中声明,如何使用boost将指向该对象的指针返回到python
- 从python调用openMP共享库时,未定义opnMP函数
- 使用JsonCpp将数据返回到带有pybind11的python会在python调用中产生Symbol not foun
- 如何将真正的字符串从python c-api转换为python脚本
- Python ctype 'c_char_p' Memory Leak