gpt4 book ai didi

python - Conda软件包需要矛盾的Numpy版本

转载 作者:行者123 更新时间:2023-12-02 17:09:40 25 4
gpt4 key购买 nike

我正在使用conda管理依赖项的共享Python项目。

我有两个导致问题的库openCVpython-pcl
openCV需要numpy 1.7.*。我只能看到一个conda包:

>conda search -f opencv
Fetching package metadata .........
opencv * 2.4.8 np17py27_2 defaults
python-pcl需要 numpy 1.9.*才能正常工作(据我所知)。也只有一个 conda package:
>conda search -c ccordoba12 python-pcl
Fetching package metadata ...........
python-pcl * 0.2 nppy27_1 ccordoba12

安装了 numpy 1.7.1后,以下 python-pcl代码会出现错误:
import pcl
import numpy as np


def main():
p = pcl.PointCloud(np.array([[1, 2, 3], [3, 4, 5]], dtype=np.float32))
seg = p.make_segmenter()
seg.set_model_type(pcl.SACMODEL_PLANE)
seg.set_method_type(pcl.SAC_RANSAC)
indices, model = seg.segment()

if __name__ == '__main__':
main()

错误是:
  import pcl
File "/Users/MyName/anaconda/envs/MyDir/lib/python2.7/site-packages/pcl/__init__.py", line 2, in <module>
from ._pcl import *
File "__init__.pxd", line 861, in init pcl._pcl (pcl/_pcl.cpp:15775)
ValueError: numpy.ufunc has the wrong size, try recompiling

有没有一种巧妙的方法可以解决此问题,以便与同事共享环境?

这是我的environment.yml文件:
name: TestEnv
channels:
- ccordoba12
- defaults
dependencies:
- boost=1.55.0=2
- eigen3=3.2.5=0
- flann=1.8.4=0
- icu=54.1=1
- pcl=1.7.2=3
- python-pcl=0.2=nppy27_1
- dateutil=2.4.1=py27_0
- freetype=2.4.10=1
- libpng=1.5.13=1
- matplotlib=1.3.1=np17py27_0
- numpy=1.7.1=py27_2
- opencv=2.4.8=np17py27_2
- openssl=1.0.2l=0
- pip=9.0.1=py27_1
- pyparsing=1.5.6=py27_0
- python=2.7.13=0
- pytz=2017.2=py27_0
- readline=6.2=2
- scipy=0.13.2=np17py27_1
- setuptools=27.2.0=py27_0
- six=1.10.0=py27_0
- sqlite=3.13.0=0
- tk=8.5.18=0
- wheel=0.29.0=py27_0
- zlib=1.2.8=3
- pip:
- python-dateutil==2.4.1
prefix: /Users/me/anaconda/envs/TestEnv

最佳答案

我认为也许您应该安装另一个版本的opencv。

试试这个:
conda search -c conda-forge opencv
https://anaconda.org/conda-forge/opencv

关于python - Conda软件包需要矛盾的Numpy版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45877027/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com