简体   繁体   中英

Windows unable to install dlib

I'm trying to install Dlib on my Windows 8.1 with this command:

python -m pip install dlib

After I run it I get this error log:

    ERROR: Command errored out with exit status 1:


    command: 'C:\Program Files (x86)\Python37-32\python.exe' -u -c 'import sys,
 setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\YOSIFA~1\\AppData\\Local\\T
emp\\pip-install-j8dowk8r\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\YOSIFA~
1\\AppData\\Local\\Temp\\pip-install-j8dowk8r\\dlib\\setup.py'"'"';f=getattr(tok
enize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'
"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --re
cord 'C:\Users\YOSIFA~1\AppData\Local\Temp\pip-record-6s43j4hs\install-record.tx
t' --single-version-externally-managed --compile
         cwd: C:\Users\YOSIFA~1\AppData\Local\Temp\pip-install-j8dowk8r\dlib\
    Complete output (66 lines):
    running install
    running build
    running build_py
    package init file 'dlib\__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19
:29:22) [MSC v.1916 32 bit (Intel)]
    Invoking CMake setup: 'cmake C:\Users\YOSIFA~1\AppData\Local\Temp\pip-instal
l-j8dowk8r\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\YOSIFA~1\
AppData\Local\Temp\pip-install-j8dowk8r\dlib\build\lib.win32-3.7 -DPYTHON_EXECUT
ABLE=C:\Program Files (x86)\Python37-32\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECT
ORY_RELEASE=C:\Users\YOSIFA~1\AppData\Local\Temp\pip-install-j8dowk8r\dlib\build
\lib.win32-3.7'
    -- Building for: Visual Studio 16 2019
    -- Selecting Windows SDK version 8.1 to target Windows 6.3.9600.
    -- The C compiler identification is MSVC 19.22.27905.0
    -- The CXX compiler identification is MSVC 19.22.27905.0
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Stu
dio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Stu
dio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual S
tudio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual S
tudio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found PythonInterp: C:/Program Files (x86)/Python37-32/python.exe (found
version "3.7.4")
    CMake Error at C:/Users/wwwwwwwww/AppData/Local/Temp/pip-install-j8dowk8
r/dlib/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:122 (message):
      Python config failure: Python is 32-bit, chosen compiler is 64-bit
    Call Stack (most recent call first):
      C:/Users/wwwwwwwww/AppData/Local/Temp/pip-install-j8dowk8r/dlib/dlib/e
xternal/pybind11/tools/pybind11Tools.cmake:16 (find_package)
      C:/Users/wwwwwwwww/AppData/Local/Temp/pip-install-j8dowk8r/dlib/dlib/e
xternal/pybind11/CMakeLists.txt:33 (include)


    -- Configuring incomplete, errors occurred!
    See also "C:/Users/wwwwwwwww/AppData/Local/Temp/pip-install-j8dowk8r/dli
b/build/temp.win32-3.7/Release/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\YOSIFA~1\AppData\Local\Temp\pip-install-j8dowk8r\dlib\setup
.py", line 261, in <module>
        'Topic :: Software Development',
      File "C:\Program Files (x86)\Python37-32\lib\site-packages\setuptools\__in
it__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:\Program Files (x86)\Python37-32\lib\distutils\core.py", line 148,
 in setup
        dist.run_commands()
      File "C:\Program Files (x86)\Python37-32\lib\distutils\dist.py", line 966,
 in run_commands
        self.run_command(cmd)
      File "C:\Program Files (x86)\Python37-32\lib\distutils\dist.py", line 985,
 in run_command
        cmd_obj.run()
      File "C:\Program Files (x86)\Python37-32\lib\site-packages\setuptools\comm
and\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Program Files (x86)\Python37-32\lib\distutils\command\install.py"
, line 545, in run
        self.run_command('build')
      File "C:\Program Files (x86)\Python37-32\lib\distutils\cmd.py", line 313,
in run_command
        self.distribution.run_command(command)
      File "C:\Program Files (x86)\Python37-32\lib\distutils\dist.py", line 985,
 in run_command
        cmd_obj.run()
      File "C:\Program Files (x86)\Python37-32\lib\distutils\command\build.py",
line 135, in run
        self.run_command(cmd_name)
      File "C:\Program Files (x86)\Python37-32\lib\distutils\cmd.py", line 313,
in run_command
        self.distribution.run_command(command)
      File "C:\Program Files (x86)\Python37-32\lib\distutils\dist.py", line 985,
 in run_command
        cmd_obj.run()
      File "C:\Users\YOSIFA~1\AppData\Local\Temp\pip-install-j8dowk8r\dlib\setup
.py", line 135, in run
        self.build_extension(ext)
      File "C:\Users\YOSIFA~1\AppData\Local\Temp\pip-install-j8dowk8r\dlib\setup
.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "C:\Program Files (x86)\Python37-32\lib\subprocess.py", line 347, in
check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\YOSIFA~1\\AppD
ata\\Local\\Temp\\pip-install-j8dowk8r\\dlib\\tools\\python', '-DCMAKE_LIBRARY_O
UTPUT_DIRECTORY=C:\\Users\\YOSIFA~1\\AppData\\Local\\Temp\\pip-install-j8dowk8r\
\dlib\\build\\lib.win32-3.7', '-DPYTHON_EXECUTABLE=C:\\Program Files (x86)\\Pyth
on37-32\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\YOSIF
A~1\\AppData\\Local\\Temp\\pip-install-j8dowk8r\\dlib\\build\\lib.win32-3.7']' r
eturned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files (x86)\Python37-
32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\U
sers\\YOSIFA~1\\AppData\\Local\\Temp\\pip-install-j8dowk8r\\dlib\\setup.py'"'"';
 __file__='"'"'C:\\Users\\YOSIFA~1\\AppData\\Local\\Temp\\pip-install-j8dowk8r\\
dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.r
ead().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file_
_, '"'"'exec'"'"'))' install --record 'C:\Users\YOSIFA~1\AppData\Local\Temp\pip-
record-6s43j4hs\install-record.txt' --single-version-externally-managed --compil
e Check the logs for full command output.

I did install Python 64 bit, Any idea what can be the problem? Why I'm still getting this error?

Dlib is support with python 3.6 to 3.7.0 version s.Try to install the dlib in anaconda prompt by following command.,

step 1: conda create -n env_name python=3.7.0

step 2: conda activate env_name

step 3: conda install -c conda-forge dlib=19.17

-c is stands for channel, conda-forge is one of channels.

you can find all supported packages for conda's in this link https://repo.anaconda.com/pkgs/main/win-64/

Anaconda is available from, https://www.anaconda.com/distribution/#download-section

conda instruction are, https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM