我已经安装了Cmake,visual studio 2019和anaconda。我正在尝试在gpu支持中使用Dlib。但是每次我尝试安装它时,运行python setup.py都会出现以下错误。我想将Dlib与GPU(CUDA)支持一起使用。
C:\Users\yugahang\anaconda3\Lib\site-packages\dlib-master>python setup.py install --set
USE_AVX_INSTRUCTIONS --set DLIB_USE_CUDA
running install
running bdist_egg
running egg_info
writing dlib.egg-info\PKG-INFO
writing dependency_links to dlib.egg-info\dependency_links.txt
writing top-level names to dlib.egg-info\top_level.txt
package init file 'dlib\__init__.py' not found (or not a regular file)
reading manifest file 'dlib.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'tools\python\build*'
writing manifest file 'dlib.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
Building extension for Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\yugahang\anaconda3\Lib\site-packages\dlib-master\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\yugahang\anaconda3\Lib\site-packages\dlib-master\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Users\yugahang\Anaconda3\python.exe -DUSE_AVX_INSTRUCTIONS -DDLIB_USE_CUDA -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\yugahang\anaconda3\Lib\site-packages\dlib-master\build\lib.win-amd64-3.7 -A x64'
CMake Error: Parse error in command line argument: -DUSE_AVX_INSTRUCTIONS
Should be: VAR:type=value
CMake Error: Problem processing arguments. Aborting.
Traceback (most recent call last):
File "setup.py", line 261, in
'Topic :: Software Development',
File "C:\Users\yugahang\Anaconda3\lib\site-packages\setuptools\__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "C:\Users\yugahang\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\yugahang\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\yugahang\Anaconda3\lib\distutils\dist.py", line 985, in run_commands` `
cmd_obj.run()
File "C:\Users\yugahang\Anaconda3\lib\site-packages\setuptools\command\install.py", line 67, in run
self.do_egg_install()
File "C:\Users\yugahang\Anaconda3\lib\site-packages\setuptools\command\install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "C:\Users\yugahang\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\yugahang\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\yugahang\Anaconda3\lib\site-packages\setuptools\command\bdist_egg.py", line 172, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "C:\Users\yugahang\Anaconda3\lib\site-packages\setuptools\command\bdist_egg.py", line 158, in call_command
self.run_command(cmdname)
File "C:\Users\yugahang\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\yugahang\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\yugahang\Anaconda3\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
self.build()
File "C:\Users\yugahang\Anaconda3\lib\distutils\command\install_lib.py", line 107, in build
self.run_command('build_ext')`
File "C:\Users\yugahang\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\yugahang\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "setup.py", line 135, in run`enter code here`
self.build_extension(ext)
File "setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Users\yugahang\Anaconda3\lib\subprocess.py", line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\yugahang\\anaconda3\\Lib\\site-packages\\dlib-master\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\yugahang\\anaconda3\\Lib\\site-packages\\dlib-master\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\\Users\\yugahang\\Anaconda3\\python.exe', '-DUSE_AVX_INSTRUCTIONS', '-DDLIB_USE_CUDA', '-`enter code here`DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\yugahang\\anaconda3\\Lib\\site-packages\\dlib-master\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
有没有解决此问题的方法。首先,我想知道是什么导致了此问题。
--set
的参数setup.py
应该采用格式
--set <variable>=<value>
这将cmake
参数转换为-D<variable>=<value>
,完全适合cmake
synopsis。
例如代替
--set USE_AVX_INSTRUCTIONS
使用
--set USE_AVX_INSTRUCTIONS=ON
--no
的参数setup.py
没有分配(=<value>
)部分,因为
--no <variable>
将自动转换为cmake
参数-D<variable>=no
。