繁体   English   中英

Python pcl没有属性from_array

[英]Python pcl has no attribute from_array

我试图在此页面上运行示例: https : //github.com/strawlab/python-pcl/blob/master/examples/example.py我收到错误消息: AttributeError: type object 'PointCloud' has no attribute 'from_array' (第49行)。此外,我无法导入一些模块,例如pcl.pcl_visualizationpcl.PointCloud_PointXYZRGB() 有人知道我该如何解决这些问题?

谢谢

您应该确保您不是意外运行PyPCL。 这是导入pcl可以映射到的PCL到Python的替代绑定。 一种检查方法是运行以下代码段:

class_names = dict([(name, cls) for name, cls in pcl.__dict__.items() if isinstance(cls, type)])
for name, cls in class_names.items():
    print(name)

这将为您提供模块中的类的列表。 如果有两个(PointCloud,Quaternion),则可能已经安装了PyPCL,应该卸载该PyPCL。 返回的python-pcl中的类列表应如下所示:

PointCloud
PointCloud_PointXYZI
PointCloud_PointXYZRGB
PointCloud_PointXYZRGBA
Vertices
PointCloud_PointWithViewpoint
PointCloud_Normal
PointCloud_PointNormal
KdTree
RangeImages
SampleConsensusModel
SampleConsensusModelPlane
SampleConsensusModelSphere
SampleConsensusModelCylinder
SampleConsensusModelLine
SampleConsensusModelRegistration
SampleConsensusModelStick
Segmentation
Segmentation_PointXYZI
Segmentation_PointXYZRGB
Segmentation_PointXYZRGBA
SegmentationNormal
Segmentation_PointXYZI_Normal
Segmentation_PointXYZRGB_Normal
Segmentation_PointXYZRGBA_Normal
EuclideanClusterExtraction
RegionGrowing
StatisticalOutlierRemovalFilter
StatisticalOutlierRemovalFilter_PointXYZI
StatisticalOutlierRemovalFilter_PointXYZRGB
StatisticalOutlierRemovalFilter_PointXYZRGBA
VoxelGridFilter
VoxelGridFilter_PointXYZI
VoxelGridFilter_PointXYZRGB
VoxelGridFilter_PointXYZRGBA
PassThroughFilter
PassThroughFilter_PointXYZI
PassThroughFilter_PointXYZRGB
PassThroughFilter_PointXYZRGBA
ApproximateVoxelGrid
ApproximateVoxelGrid_PointXYZI
ApproximateVoxelGrid_PointXYZRGB
ApproximateVoxelGrid_PointXYZRGBA
KdTreeFLANN
KdTreeFLANN_PointXYZI
KdTreeFLANN_PointXYZRGB
KdTreeFLANN_PointXYZRGBA
OctreePointCloud
OctreePointCloud_PointXYZI
OctreePointCloud_PointXYZRGB
OctreePointCloud_PointXYZRGBA
OctreePointCloud2Buf
OctreePointCloud2Buf_PointXYZI
OctreePointCloud2Buf_PointXYZRGB
OctreePointCloud2Buf_PointXYZRGBA
OctreePointCloudSearch
OctreePointCloudSearch_PointXYZI
OctreePointCloudSearch_PointXYZRGB
OctreePointCloudSearch_PointXYZRGBA
OctreePointCloudChangeDetector
OctreePointCloudChangeDetector_PointXYZI
OctreePointCloudChangeDetector_PointXYZRGB
OctreePointCloudChangeDetector_PointXYZRGBA
CropHull
CropBox
ProjectInliers
RadiusOutlierRemoval
ConditionAnd
ConditionalRemoval
ConcaveHull
ConcaveHull_PointXYZI
ConcaveHull_PointXYZRGB
ConcaveHull_PointXYZRGBA
MovingLeastSquares
MovingLeastSquares_PointXYZRGB
MovingLeastSquares_PointXYZRGBA
GeneralizedIterativeClosestPoint
IterativeClosestPoint
IterativeClosestPointNonLinear
RandomSampleConsensus
NormalEstimation
VFHEstimation
IntegralImageNormalEstimation
MomentOfInertiaEstimation
HarrisKeypoint3D
NormalDistributionsTransform
Sequence

另外,如果您在虚拟环境中,则可以运行pipenv graph来查找此问题。 要么:

pip list

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM