pipenv 无法安装软件包

pipenv fails to install packages

我想在面部识别应用程序的 pipenv 中安装以下软件包。几乎所有这些软件包的安装过程都失败了。

唯一正确安装的软件包是 opencv-python 和 numpy

我已经搜索了其他 Whosebug 帖子,其中 none 似乎有帮助。

错误输出:

(SecureCam) C:\dev\python\SecureCam>pipenv install dlib
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to
 suppress this warning.
Installing dlib…
Adding dlib to Pipfile's [packages]…
Installation Succeeded
Installing dependencies from Pipfile.lock (d62603)…
An error occurred while installing dlib==19.19.0 --hash=sha256:d0eeaca07bc4c75973ad0f739a541d8fa4003af778f0dc1c2c595d470823819a! Will try again.
  ================================ 4/4 - 00:00:05
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]:   File "c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\lib\site-packages\pipenv\core.py", line 1983, in do_install
[pipenv.exceptions.InstallError]:       do_init(
[pipenv.exceptions.InstallError]:   File "c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\lib\site-packages\pipenv\core.py", line 1246, in do_init
[pipenv.exceptions.InstallError]:       do_install_dependencies(
[pipenv.exceptions.InstallError]:   File "c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\lib\site-packages\pipenv\core.py", line 858, in do_install_dependencies
[pipenv.exceptions.InstallError]:       batch_install(
[pipenv.exceptions.InstallError]:   File "c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\lib\site-packages\pipenv\core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]:       _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]:   File "c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\lib\site-packages\pipenv\core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting dlib==19.19.0 (from -r C:\Users\THEALP~1\AppData\Local\Temp\pipenv-imqiansg-requirements\pipenv-08m7x4g7-requirement.txt (line 1))', '  Using cached https://files.pythonhosted.org/packages/63/92/05c3b98636661cb80d190a5a777dd94effcc14c0f6893222e5ca81e74fbc/dl
ib-19.19.0.tar.gz', 'Building wheels for collected packages: dlib', '  Running setup.py bdist_wheel for dlib: started', "  Running setup.py bdist_wheel for dlib: finished with status 'error'", '  Complete output from command c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\scripts\python.exe -u -c "i
mport setuptools, tokenize;__file__=\'C:\\Users\\TheAlphaKarp\\AppData\\Local\\Temp\\pip-install-7ilrv6cx\\dlib\\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\TheAlp
haKarp\AppData\Local\Temp\pip-wheel-4ikt0xup --python-tag cp38:', '  running bdist_wheel', '  running build', '  running build_py', "  package init file 'dlib\__init__.py' not found (or not a regular file)", '  warning: build_py: byte-compiling is disabled, skipping.', '  ', '  running build_ext', '  Build
ing extension for Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]', "  Invoking CMake setup: 'cmake C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-i
nstall-7ilrv6cx\dlib\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\build\lib.win-amd64-3.8 -A x64'", '  -- Building
 for: NMake Makefiles', '  CMake Error at CMakeLists.txt:3 (project):', '    Generator', '  ', '      NMake Makefiles', '  ', '    does not support platform specification, but platform', '  ', '      x64', '  ', '    was specified.', '  ', '  ', '  CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage', '
  CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage', '  -- Configuring incomplete, errors occurred!', '  See also "C:/Users/TheAlphaKarp/AppData/Local/Temp/pip-install-7ilrv6cx/dlib/build/temp.win-amd64-3.8/Release/CMakeFiles/CMakeOutput.log".', '  Traceback (most recent call last):', '    File "<s
tring>", line 1, in <module>', '    File "C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\setup.py", line 223, in <module>', '      setup(', '    File "c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\lib\site-packages\setuptools\__init__.py", line 144, in setup', '
return distutils.core.setup(**attrs)', '    File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\core.py", line 148, in setup', '      dist.run_commands()', '    File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\dist.py", line 966, i
n run_commands', '      self.run_command(cmd)', '    File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command', '      cmd_obj.run()', '    File "c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\lib\site-packages\wheel\bdist_wheel
.py", line 223, in run', "      self.run_command('build')", '    File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command', '      self.distribution.run_command(command)', '    File "c:\users\thealphakarp\appdata\local\programs\python\py
thon38\lib\distutils\dist.py", line 985, in run_command', '      cmd_obj.run()', '    File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\command\build.py", line 135, in run', '      self.run_command(cmd_name)', '    File "c:\users\thealphakarp\appdata\local\progr
ams\python\python38\lib\distutils\cmd.py", line 313, in run_command', '      self.distribution.run_command(command)', '    File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command', '      cmd_obj.run()', '    File "C:\Users\TheAlphaKar
p\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\setup.py", line 135, in run', '      self.build_extension(ext)', '    File "C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\setup.py", line 172, in build_extension', '      subprocess.check_call(cmake_setup, cwd=build_folder)', '
 File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\subprocess.py", line 364, in check_call', '      raise CalledProcessError(retcode, cmd)', "  subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\TheAlphaKarp\\AppData\\Local\\Temp\\pip-install-7ilrv6cx\\dlib
\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\TheAlphaKarp\\AppData\\Local\\Temp\\pip-install-7ilrv6cx\\dlib\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=c:\\users\\thealphakarp\\.virtualenvs\\securecam-pkqbmejs\\scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPU
T_DIRECTORY_RELEASE=C:\\Users\\TheAlphaKarp\\AppData\\Local\\Temp\\pip-install-7ilrv6cx\\dlib\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.", '  ', '  ----------------------------------------', '  Running setup.py clean for dlib', 'Failed to build dlib', 'Installin
g collected packages: dlib', '  Running setup.py install for dlib: started', "    Running setup.py install for dlib: finished with status 'error'", '    Complete output from command c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\scripts\python.exe -u -c "import setuptools, tokenize;__file__=\'C:\\
\Users\\TheAlphaKarp\\AppData\\Local\\Temp\\pip-install-7ilrv6cx\\dlib\\setup.py\';f=getattr(tokenize, \'open\', open)(__file__);code=f.read().replace(\'\r\n\', \'\n\');f.close();exec(compile(code, __file__, \'exec\'))" install --record C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-record-
fbfltxrc\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\include\site\python3.8\dlib:', '    running install', '    running build', '    running build_py', "    package init file 'dlib\__init__.py' not found (or n
ot a regular file)", '    warning: build_py: byte-compiling is disabled, skipping.', '    ', '    running build_ext', '    Building extension for Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]', "    Invoking CMake setup: 'cmake C:\Users\TheAlphaKarp\AppData\Local\Tem
p\pip-install-7ilrv6cx\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RE
LEASE=C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\build\lib.win-amd64-3.8 -A x64'", '    -- Building for: NMake Makefiles', '    CMake Error at CMakeLists.txt:3 (project):', '      Generator', '    ', '        NMake Makefiles', '    ', '      does not support platform specificati
on, but platform', '    ', '        x64', '    ', '      was specified.', '    ', '    ', '    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage', '    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage', '    -- Configuring incomplete, errors occurred!', '    See also "C:/Users/TheAlphaKar
p/AppData/Local/Temp/pip-install-7ilrv6cx/dlib/build/temp.win-amd64-3.8/Release/CMakeFiles/CMakeOutput.log".', '    Traceback (most recent call last):', '      File "<string>", line 1, in <module>', '      File "C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\setup.py", line 223, in <
module>', '        setup(', '      File "c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\lib\site-packages\setuptools\__init__.py", line 144, in setup', '        return distutils.core.setup(**attrs)', '      File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\
\core.py", line 148, in setup', '        dist.run_commands()', '      File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\dist.py", line 966, in run_commands', '        self.run_command(cmd)', '      File "c:\users\thealphakarp\appdata\local\programs\python\python38
\lib\distutils\dist.py", line 985, in run_command', '        cmd_obj.run()', '      File "c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\lib\site-packages\setuptools\command\install.py", line 61, in run', '        return orig.install.run(self)', '      File "c:\users\thealphakarp\appdata\
local\programs\python\python38\lib\distutils\command\install.py", line 545, in run', "        self.run_command('build')", '      File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command', '        self.distribution.run_command(command)',
 '      File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command', '        cmd_obj.run()', '      File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\command\build.py", line 135, in run', '        self.
run_command(cmd_name)', '      File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command', '        self.distribution.run_command(command)', '      File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\distutils\dist.p
y", line 985, in run_command', '        cmd_obj.run()', '      File "C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\setup.py", line 135, in run', '        self.build_extension(ext)', '      File "C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\setup.py", li
ne 172, in build_extension', '        subprocess.check_call(cmake_setup, cwd=build_folder)', '      File "c:\users\thealphakarp\appdata\local\programs\python\python38\lib\subprocess.py", line 364, in check_call', '        raise CalledProcessError(retcode, cmd)', "    subprocess.CalledProcessError: Comm
and '['cmake', 'C:\\Users\\TheAlphaKarp\\AppData\\Local\\Temp\\pip-install-7ilrv6cx\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\TheAlphaKarp\\AppData\\Local\\Temp\\pip-install-7ilrv6cx\\dlib\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=c:\\users\
\\thealphakarp\\.virtualenvs\\securecam-pkqbmejs\\scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\TheAlphaKarp\\AppData\\Local\\Temp\\pip-install-7ilrv6cx\\dlib\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.", '    ', '    -------
---------------------------------']
[pipenv.exceptions.InstallError]: ['Failed building wheel for dlib', 'Command "c:\users\thealphakarp\.virtualenvs\securecam-pkqbmejs\scripts\python.exe -u -c "import setuptools, tokenize;__file__=\'C:\\Users\\TheAlphaKarp\\AppData\\Local\\Temp\\pip-install-7ilrv6cx\\dlib\\setup.py\';f=geta
ttr(tokenize, \'open\', open)(__file__);code=f.read().replace(\'\r\n\', \'\n\');f.close();exec(compile(code, __file__, \'exec\'))" install --record C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-record-fbfltxrc\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\
\thealphakarp\.virtualenvs\securecam-pkqbmejs\include\site\python3.8\dlib" failed with error code 1 in C:\Users\TheAlphaKarp\AppData\Local\Temp\pip-install-7ilrv6cx\dlib\']
ERROR: ERROR: Package installation failed...
     ================================ 0/1 - 00:00:05

编辑:PyCharm 2020

下载 visual studio 社区 C++ 开发构建工具并重新启动计算机。

参考视频: https://www.youtube.com/watch?v=D5xqcGk6LEc

在你的 PyCharm 中转到 File -> settings -> Project:test(test means your project name) -> select project interpretor -> click add button

单击添加按钮并搜索 您的库并单击安装后。一个图书馆一个图书馆做这个。

  • cmake
  • face-recognition
  • numpy
  • dlib
  • opencv-python

更新

对于 c++ 开发构建工具问题,我已经在此站点中讨论过。阅读 解决 C++ 开发构建工具问题的答案。

我之前遇到过问题,但我通过 anaconda 提示安装我的包解决了这个问题