如何在Windows上安装FLANN和pyflann

时间:2013-08-10 15:00:39

标签: python flann

如何在Windows上设置Python(pyflann)上的FLANN?我知道FLANN现在在openCV,但我需要独立版本。 instructions here建议编译FLANN二进制文件或从PointClouds下载版本,但我不能使用其中任何一个版本。

我是从源代码编译的,但是在我尝试运行setup.py之后,我收到了这个错误:

> 
C:\Python27\flann-1.8.4-src\src\python>python setup.py install
running install
running build
running build_py
Traceback (most recent call last):
  File "setup.py", line 27, in <module>
    package_data={'pyflann.lib': ['libflann.so', 'flann.dll', 'libflann.dll', 'libflann.dylib']},
  File "C:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run()
  File "C:\Python27\lib\distutils\command\install.py", line 563, in run self.run_command('build')
  File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command self.distribution.run_command(command)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run()
  File "C:\Python27\lib\distutils\command\build.py", line 127, in run self.run_command(cmd_name)
  File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command self.distribution.run_command(command)
  File "C:\Python27\lib\distutils\dist.py", line 971, in run_command cmd_obj.ensure_finalized()
  File "C:\Python27\lib\distutils\cmd.py", line 109, in ensure_finalized self.finalize_options()
  File "C:\Python27\lib\distutils\command\build_py.py", line 57, in finalize_options self.data_files = self.get_data_files()
  File "C:\Python27\lib\distutils\command\build_py.py", line 117, in get_data_files file[plen:] for file in self.find_data_files(package, src_dir)
  File "C:\Python27\lib\distutils\command\build_py.py", line 129, in find_data_files filelist = glob(os.path.join(src_dir, convert_path(pattern)))
  File "C:\Python27\lib\ntpath.py", line 96, in join assert len(path) > 0
TypeError: object of type 'NoneType' has no len()

有没有人可以帮我解决这个问题,或者让我指向另一个版本的flann,我可以直接安装吗?

1 个答案:

答案 0 :(得分:4)

  • 将压缩存档解压缩到C:\flann-1.8.4-src\
  • 以管理员身份打开cmd窗口(右键单击&gt;以管理员身份运行)

然后执行以下操作:

cd C:\flann-1.8.4-src\
mkdir build
cd build
cmake .. -G "NMake Makefiles"
nmake install

nmake install行应安装pyflann,而无需另行拨打setup.py