Visual Studio 2019 has been installed in my windows. I have coded c++ with it, and it doesn't have any problem with the compiler. The compiler, cl.exe
, exists in this directory:
C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\Hostx64\\x64
When I wanted to install dlib using pip, CMake couldn't compile it.
pip install dlib ─╯
Collecting dlib
Using cached dlib-19.22.1.tar.gz (7.4 MB)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'D:\Anaconda\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\setup.py'"'"'; __file__='"'"'C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\ali entezari\AppData\Local\Temp\pip-wheel-cc19gyz4'
cwd: C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\
Complete output (58 lines):
running bdist_wheel
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=D:\Anaconda\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\build\lib.win-amd64-3.8 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You must use Visual Studio to build a python extension on windows. If you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\setup.py", line 222, in <module>
setup(
File "D:\Anaconda\anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "D:\Anaconda\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Anaconda\anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
self.run_command('build')
File "D:\Anaconda\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Anaconda\anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "D:\Anaconda\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "D:\Anaconda\anaconda3\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=D:\\Anaconda\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
I've checked my environment variable path; VS2019INSTALLDIR
was there.
VS2019INSTALLDIR | C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community |
---|
I had this problem with compiling Mozilla Firefox before, and I couldn't solve it. I will be appreciated if anyone could help me to get rid of this problem. Sorry for English, I'm not a native speaker :).
I had the same problem. It was probably related to the plugins and extensions you have installed. My issue was not resolved until I reinstalled Visual Studio. Try to install it again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.