Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

python - Error in installing face_recognition module using pip

I am using vs code in windows 10. When I install face_recognition in vs code using pip I got the following error, I have also tried to install dlib before installing face_recognition.

 ERROR: Command errored out with exit status 1:
     command: 'c:usersadminappdatalocalprogramspythonpython38python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersAdminAppDataLocalTemppip-record-f5b3pskrinstall-record.txt' --single-version-externally-managed --compile --install-headers 'c:usersadminappdatalocalprogramspythonpython38Includedlib'
         cwd: C:UsersAdminAppDataLocalTemppip-install-fi__6w9vdlib
    Complete output (60 lines):
    running install
    running build
    running build_py
    package init file 'toolspythondlib\__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:UsersAdminAppDataLocalTemppip-install-fi__6w9vdliboolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersAdminAppDataLocalTemppip-install-fi__6w9vdlibuildlib.win-amd64-3.8 -DPYTHON_EXECUTABLE=c:usersadminappdatalocalprogramspythonpython38python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersAdminAppDataLocalTemppip-install-fi__6w9vdlibuildlib.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:UsersAdminAppDataLocalTemppip-install-fi__6w9vdlibsetup.py", line 223, in <module>
        setup(
      File "c:usersadminappdatalocalprogramspythonpython38libsite-packagessetuptools\__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "c:usersadminappdatalocalprogramspythonpython38libdistutilscore.py", line 148, in setup
        dist.run_commands()
      File "c:usersadminappdatalocalprogramspythonpython38libdistutilsdist.py", line 966, in run_commands
        self.run_command(cmd)
      File "c:usersadminappdatalocalprogramspythonpython38libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "c:usersadminappdatalocalprogramspythonpython38libsite-packagessetuptoolscommandinstall.py", line 61, in run
        return orig.install.run(self)
      File "c:usersadminappdatalocalprogramspythonpython38libdistutilscommandinstall.py", line 545, in run
        self.run_command('build')
      File "c:usersadminappdatalocalprogramspythonpython38libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:usersadminappdatalocalprogramspythonpython38libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "c:usersadminappdatalocalprogramspythonpython38libdistutilscommanduild.py", line 135, in run
        self.run_command(cmd_name)
      File "c:usersadminappdatalocalprogramspythonpython38libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:usersadminappdatalocalprogramspythonpython38libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersAdminAppDataLocalTemppip-install-fi__6w9vdlibsetup.py", line 135, in run
        self.build_extension(ext)
      File "C:UsersAdminAppDataLocalTemppip-install-fi__6w9vdlibsetup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "c:usersadminappdatalocalprogramspythonpython38libsubprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\build\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=c:\users\admin\appdata\local\programs\python\python38\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\build\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:usersadminappdatalocalprogramspythonpython38python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersAdminAppDataLocalTemppip-record-f5b3pskrinstall-record.txt' --single-version-externally-managed --compile --install-headers 'c:usersadminappdatalocalprogramspythonpython38Includedlib' Check the logs for full command output.
See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

The answer is really simple. You have to do what it says. Go to the VS installer and install VS for C++ and C#. The reason is that these modules use C code and while using Visual Studio, you have to make it so that it can compile the C++ code


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...