1

我已经使用该命令在 Windows 10 上成功安装了 darkflow-1.0.0 ( https://github.com/thtrieu/darkflow )。pip install .

Successfully built darkflow
Installing collected packages: darkflow
  Found existing installation: darkflow 1.0.0
    Uninstalling darkflow-1.0.0:
      Successfully uninstalled darkflow-1.0.0
Successfully installed darkflow-1.0.0

在此之后,我尝试运行python flow --h,这给了我以下错误:

Traceback (most recent call last):
  File "flow", line 4, in <module>
    from darkflow.cli import cliHandler
  File "C:\Users\filda\Desktop\FIT_VUT\BP\YOLO\YOLO_keras\darkflow\darkflow\cli.py", line 3, in <module>
    from .net.build import TFNet
  File "C:\Users\filda\Desktop\FIT_VUT\BP\YOLO\YOLO_keras\darkflow\darkflow\net\build.py", line 7, in <module>
    from .framework import create_framework
  File "C:\Users\filda\Desktop\FIT_VUT\BP\YOLO\YOLO_keras\darkflow\darkflow\net\framework.py", line 1, in <module>
    from . import yolo
  File "C:\Users\filda\Desktop\FIT_VUT\BP\YOLO\YOLO_keras\darkflow\darkflow\net\yolo\__init__.py", line 2, in <module>
    from . import predict
  File "C:\Users\filda\Desktop\FIT_VUT\BP\YOLO\YOLO_keras\darkflow\darkflow\net\yolo\predict.py", line 7, in <module>
    from ...cython_utils.cy_yolo_findboxes import yolo_box_constructor
ModuleNotFoundError: No module named 'darkflow.cython_utils.cy_yolo_findboxes'

所以我尝试使用该python setup.py build_ext --inplace命令构建 Cython 扩展,这给了我以下错误:

(base) C:\Users\filda\Desktop\FIT_VUT\BP\YOLO\YOLO_keras\darkflow-master>python setup.py build_ext --inplace
running build_ext
building 'darkflow.cython_utils.nms' extension
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
creating build\temp.win-amd64-3.5\Release\darkflow
creating build\temp.win-amd64-3.5\Release\darkflow\cython_utils
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -IC:\Users\filda\Anaconda3\lib\site-packages\numpy\core\include -IC:\Users\filda\Anaconda3\include -IC:\Users\filda\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\ATLMFC\Include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" /Tcdarkflow/cython_utils/nms.c /Fobuild\temp.win-amd64-3.5\Release\darkflow/cython_utils/nms.obj
nms.c
c1: fatal error C1083: Cannot open source file: 'darkflow/cython_utils/nms.c': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX64\\x64\\cl.exe' failed with exit status 2

pip show -f 暗流:

Name: darkflow
Version: 1.0.0
Summary: Darkflow
Home-page: https://github.com/thtrieu/darkflow
Author: UNKNOWN
Author-email: UNKNOWN
License: GPLv3
Location: c:\users\filda\anaconda3\lib\site-packages
Requires:
Required-by:
Files:
  ..\..\Scripts\flow
  darkflow-1.0.0.dist-info\INSTALLER
  darkflow-1.0.0.dist-info\METADATA
  darkflow-1.0.0.dist-info\RECORD
  darkflow-1.0.0.dist-info\WHEEL
  darkflow-1.0.0.dist-info\top_level.txt
  darkflow\__init__.py
  darkflow\__pycache__\__init__.cpython-35.pyc
  darkflow\__pycache__\cli.cpython-35.pyc
  darkflow\__pycache__\defaults.cpython-35.pyc
  darkflow\__pycache__\version.cpython-35.pyc
  darkflow\cli.py
  darkflow\cython_utils\__init__.py
  darkflow\cython_utils\__pycache__\__init__.cpython-35.pyc
  darkflow\cython_utils\cy_yolo2_findboxes.cp35-win_amd64.pyd
  darkflow\cython_utils\cy_yolo_findboxes.cp35-win_amd64.pyd
  darkflow\cython_utils\nms.cp35-win_amd64.pyd
  darkflow\dark\__init__.py
  darkflow\dark\__pycache__\__init__.cpython-35.pyc
  darkflow\dark\__pycache__\connected.cpython-35.pyc
  darkflow\dark\__pycache__\convolution.cpython-35.pyc
  darkflow\dark\__pycache__\darknet.cpython-35.pyc
  darkflow\dark\__pycache__\darkop.cpython-35.pyc
  darkflow\dark\__pycache__\layer.cpython-35.pyc
  darkflow\dark\connected.py
  darkflow\dark\convolution.py
  darkflow\dark\darknet.py
  darkflow\dark\darkop.py
  darkflow\dark\layer.py
  darkflow\defaults.py
  darkflow\net\__init__.py
  darkflow\net\__pycache__\__init__.cpython-35.pyc
  darkflow\net\__pycache__\build.cpython-35.pyc
  darkflow\net\__pycache__\flow.cpython-35.pyc
  darkflow\net\__pycache__\framework.cpython-35.pyc
  darkflow\net\__pycache__\help.cpython-35.pyc
  darkflow\net\build.py
  darkflow\net\flow.py
  darkflow\net\framework.py
  darkflow\net\help.py
  darkflow\net\ops\__init__.py
  darkflow\net\ops\__pycache__\__init__.cpython-35.pyc
  darkflow\net\ops\__pycache__\baseop.cpython-35.pyc
  darkflow\net\ops\__pycache__\convolution.cpython-35.pyc
  darkflow\net\ops\__pycache__\simple.cpython-35.pyc
  darkflow\net\ops\baseop.py
  darkflow\net\ops\convolution.py
  darkflow\net\ops\simple.py
  darkflow\net\vanilla\__init__.py
  darkflow\net\vanilla\__pycache__\__init__.cpython-35.pyc
  darkflow\net\vanilla\__pycache__\train.cpython-35.pyc
  darkflow\net\vanilla\train.py
  darkflow\net\yolo\__init__.py
  darkflow\net\yolo\__pycache__\__init__.cpython-35.pyc
  darkflow\net\yolo\__pycache__\data.cpython-35.pyc
  darkflow\net\yolo\__pycache__\misc.cpython-35.pyc
  darkflow\net\yolo\__pycache__\predict.cpython-35.pyc
  darkflow\net\yolo\__pycache__\train.cpython-35.pyc
  darkflow\net\yolo\data.py
  darkflow\net\yolo\misc.py
  darkflow\net\yolo\predict.py
  darkflow\net\yolo\train.py
  darkflow\net\yolov2\__init__.py
  darkflow\net\yolov2\__pycache__\__init__.cpython-35.pyc
  darkflow\net\yolov2\__pycache__\data.cpython-35.pyc
  darkflow\net\yolov2\__pycache__\predict.cpython-35.pyc
  darkflow\net\yolov2\__pycache__\train.cpython-35.pyc
  darkflow\net\yolov2\data.py
  darkflow\net\yolov2\predict.py
  darkflow\net\yolov2\train.py
  darkflow\utils\__init__.py
  darkflow\utils\__pycache__\__init__.cpython-35.pyc
  darkflow\utils\__pycache__\box.cpython-35.pyc
  darkflow\utils\__pycache__\im_transform.cpython-35.pyc
  darkflow\utils\__pycache__\loader.cpython-35.pyc
  darkflow\utils\__pycache__\pascal_voc_clean_xml.cpython-35.pyc
  darkflow\utils\__pycache__\process.cpython-35.pyc
  darkflow\utils\box.py
  darkflow\utils\im_transform.py
  darkflow\utils\loader.py
  darkflow\utils\pascal_voc_clean_xml.py
  darkflow\utils\process.py
  darkflow\version.py

我已经让它在 linux 上运行,但我仍然希望它也能在 windows 上运行。有人可以指出我正确的方向吗?

4

1 回答 1

5

这是一个名称冲突:您已经成功安装了包 via pip install .,所以现在darkflow可以在sys.pathviasite-packages目录中使用。但是,当您运行时,python script.py当前工作目录会添加sys.path到. 由于源代码目录不包含共享对象,因此脚本失败。darkflowsite-packages

解决方案是从另一个目录运行脚本,例如

cd %HOMEPATH% & flow -h

或者,如果您需要使用代码,请以可编辑模式重新安装包:

pip uninstall -y darkflow & cd path\to\darkflow-master & pip install -e .

这样,共享对象将与源代码一起编译和放置,因此您flow现在可以在任何地方运行。

于 2018-10-03T17:43:29.707 回答