已解决cython_bbox安装出现的问题

为了跑FairMOT代码,配置环境时遇到了该问题。

我已经安装了cython,然后下载了压缩包,解压后打开cython_bbox-0.1.3文件夹

打开文件setup.py
将extra_compile_args=['-Wno-cpp'],修改为extra_compile_args = {'gcc': ['/Qstd=c99']}
然后在setup.py文件的当前路径, 打开命令行, 执行python setup.py build_ext install

执行时报错:

D:\code and video\FairMOT-master_!\cython_bbox-0.1.3>conda activate FairMOT

(FairMOT) D:\code and video\FairMOT-master_!\cython_bbox-0.1.3>python setup.py build_ext install
Compiling src/cython_bbox.pyx because it depends on D:\Program Files\anaconda3\envs\FairMOT\lib\site-packages\numpy\__init__.pxd.
[1/1] Cythonizing src/cython_bbox.pyx
D:\Program Files\anaconda3\envs\FairMOT\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: D:\code and video\FairMOT-master_!\cython_bbox-0.1.3\src\cython_bbox.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
running build_ext
building 'cython_bbox' extension
creating build
creating build\temp.win-amd64-3.8
creating build\temp.win-amd64-3.8\Release
creating build\temp.win-amd64-3.8\Release\src
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-ID:\Program Files\anaconda3\envs\FairMOT\lib\site-packages\numpy\core\include" "-ID:\Program Files\anaconda3\envs\FairMOT\include" "-ID:\Program Files\anaconda3\envs\FairMOT\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt" /Tcsrc/cython_bbox.c /Fobuild\temp.win-amd64-3.8\Release\src/cython_bbox.obj gcc
cl: 命令行 warning D9024 :无法识别的源文件类型“gcc”,假定为对象文件
cl: 命令行 warning D9027 :源文件“gcc”被忽略
cython_bbox.c
d:\program files\anaconda3\envs\fairmot\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
src/cython_bbox.c(1982): warning C4244: “=”: 从“npy_intp”转换到“unsigned int”,可能丢失数据
src/cython_bbox.c(1991): warning C4244: “=”: 从“npy_intp”转换到“unsigned int”,可能丢失数据
creating D:\code and video\FairMOT-master_!\cython_bbox-0.1.3\build\lib.win-amd64-3.8
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:D:\Program Files\anaconda3\envs\FairMOT\libs" "/LIBPATH:D:\Program Files\anaconda3\envs\FairMOT" "/LIBPATH:D:\Program Files\anaconda3\envs\FairMOT\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" /EXPORT:PyInit_cython_bbox build\temp.win-amd64-3.8\Release\src/cython_bbox.obj /OUT:build\lib.win-amd64-3.8\cython_bbox.cp38-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.8\Release\src\cython_bbox.cp38-win_amd64.lib
  正在创建库 build\temp.win-amd64-3.8\Release\src\cython_bbox.cp38-win_amd64.lib 和对象 build\temp.win-amd64-3.8\Release\src\cython_bbox.cp38-win_amd64.exp
正在生成代码
已完成代码的生成
running install
D:\Program Files\anaconda3\envs\FairMOT\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
D:\Program Files\anaconda3\envs\FairMOT\lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing cython_bbox.egg-info\PKG-INFO
writing dependency_links to cython_bbox.egg-info\dependency_links.txt
writing top-level names to cython_bbox.egg-info\top_level.txt
reading manifest file 'cython_bbox.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'cython_bbox.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
copying build\lib.win-amd64-3.8\cython_bbox.cp38-win_amd64.pyd -> build\bdist.win-amd64\egg
creating stub loader for cython_bbox.cp38-win_amd64.pyd
byte-compiling build\bdist.win-amd64\egg\cython_bbox.py to cython_bbox.cpython-38.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying cython_bbox.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying cython_bbox.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying cython_bbox.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying cython_bbox.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
writing build\bdist.win-amd64\egg\EGG-INFO\native_libs.txt
zip_safe flag not set; analyzing archive contents...
__pycache__.cython_bbox.cpython-38: module references __file__
creating dist
creating 'dist\cython_bbox-0.1.3-py3.8-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing cython_bbox-0.1.3-py3.8-win-amd64.egg
creating d:\program files\anaconda3\envs\fairmot\lib\site-packages\cython_bbox-0.1.3-py3.8-win-amd64.egg
Extracting cython_bbox-0.1.3-py3.8-win-amd64.egg to d:\program files\anaconda3\envs\fairmot\lib\site-packages
Adding cython-bbox 0.1.3 to easy-install.pth file

Installed d:\program files\anaconda3\envs\fairmot\lib\site-packages\cython_bbox-0.1.3-py3.8-win-amd64.egg
Processing dependencies for cython-bbox==0.1.3
Finished processing dependencies for cython-bbox==0.1.3

(FairMOT) D:\code and video\FairMOT-master_!\cython_bbox-0.1.3>

 

到这里,看似安装好了,但是后面调用时出现报错:

No module named 'cython_bbox'

我怀疑这个安装是出问题了。求助

………………

问题已经解决,忘记过程了。之后重装了一遍环境,按照开头说的改一些代码,就没遇到这个错误了。

我改过cpp_extension里的代码,ninjia,-v那个和gkb那个。具体的请在csdn搜索cpp-extension。

 

你可能感兴趣的:(深度学习,python,神经网络,机器学习)