Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
933 views
in Technique[技术] by (71.8m points)

python - VSCode v1.35 - RuntimeError: CMake must be installed to build the following extensions: dlib

I have already installed CMake by pip install cmake in my VS Code 1.35 and trying to install face_recognition but it still give me a RuntimeError. I'm using 'Python 3.7.3, x32'

I also tried to install the dlib by pip install dlib since it is one of the reason why I can't install face_recognition.

C:Usersuser>python -m pip install cmake
Requirement already satisfied: cmake in c:usersuserappdata
oamingpythonpython37site-packages (3.14.4)

C:Usersuser>python -m pip install dlib
Collecting dlib
  Using cached https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
Installing collected packages: dlib
  Running setup.py install for dlib ... error
    ERROR: Complete output from command 'C:PythonPython37python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersuserAppDataLocalTemppip-record-yf2kdjpxinstall-record.txt' --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    package init file 'dlib\__init__.py' not found (or not a regular file)
    running build_ext
    Traceback (most recent call last):
      File "C:UsersuserAppDataLocalTemppip-install-24vk6actdlibsetup.py", line 120, in get_cmake_version
        out = subprocess.check_output(['cmake', '--version'])
      File "C:PythonPython37libsubprocess.py", line 395, in check_output
        **kwargs).stdout
      File "C:PythonPython37libsubprocess.py", line 472, in run
        with Popen(*popenargs, **kwargs) as process:
      File "C:PythonPython37libsubprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "C:PythonPython37libsubprocess.py", line 1178, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersuserAppDataLocalTemppip-install-24vk6actdlibsetup.py", line 261, in <module>
        'Topic :: Software Development',
      File "C:UsersuserAppDataRoamingPythonPython37site-packagessetuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:PythonPython37libdistutilscore.py", line 148, in setup
        dist.run_commands()
      File "C:PythonPython37libdistutilsdist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:PythonPython37libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersuserAppDataRoamingPythonPython37site-packagessetuptoolscommandinstall.py", line 61, in run
        return orig.install.run(self)
      File "C:PythonPython37libdistutilscommandinstall.py", line 545, in run
        self.run_command('build')
      File "C:PythonPython37libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:PythonPython37libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:PythonPython37libdistutilscommanduild.py", line 135, in run
        self.run_command(cmd_name)
      File "C:PythonPython37libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:PythonPython37libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersuserAppDataLocalTemppip-install-24vk6actdlibsetup.py", line 129, in run
        cmake_version = self.get_cmake_version()
      File "C:UsersuserAppDataLocalTemppip-install-24vk6actdlibsetup.py", line 125, in get_cmake_version
        "
*******************************************************************
")
    RuntimeError:
    *******************************************************************
     CMake must be installed to build the following extensions: dlib
    *******************************************************************

    ----------------------------------------
ERROR: Command "'C:PythonPython37python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersuserAppDataLocalTemppip-record-yf2kdjpxinstall-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:UsersuserAppDataLocalTemppip-install-24vk6actdlib

I'm hoping that somebody can help me with this. I'm new and really a beginner in using python and tried different suggestions from other questions. Hope that somebody will notice my question. Thank you!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Download and install dlib wheel from here

Then pip install face_recognition


  • pip install cmake
  • In visual studio, Individual Components tab,Visual C++ tools for Cmake checkbox under Compilers,build tools and runtimes Section
  • On Visual Studio Command prompt run, pip install face_recognition

Source


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...