dlib不安装(cmake)
嗨,我正在尝试通过CMake安装DLIB,但我一直遇到错误:Legacy-install-failure 这是完整的读数 (我已经用用户替换了我的实际用户名)。 /strong>
>C:\Users\USER->pip install dlib
Collecting dlib
Using cached dlib-19.23.1.tar.gz (7.4 MB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib ... error
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [73 lines of output]
running install
C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\setup.py:129: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(cmake_version) < '3.1.0':
Building extension for Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\build\lib.win-amd64-3.10 -DPYTHON_EXECUTABLE=C:\Users\USER-\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\build\lib.win-amd64-3.10 -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 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\setup.py", line 222, in <module>
setup(
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\__init__.py", line 79, in setup
return distutils.core.setup(**attrs)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\core.py", line 148, in setup
return run_commands(dist)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
dist.run_commands()
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
self.run_command(cmd)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 1196, in run_command
super().run_command(command)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\command\install.py", line 68, in run
return orig.install.run(self)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\command\install.py", line 670, in run
self.run_command('build')
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 1196, in run_command
super().run_command(command)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 1196, in run_command
super().run_command(command)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\USER-\\AppData\\Local\\Temp\\pip-install-q7gocxf3\\dlib_ba1eccb06b884bc4a89365e82ab2b34f\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\USER-\\AppData\\Local\\Temp\\pip-install-q7gocxf3\\dlib_ba1eccb06b884bc4a89365e82ab2b34f\\build\\lib.win-amd64-3.10', '-DPYTHON_EXECUTABLE=C:\\Users\\USER-\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\USER-\\AppData\\Local\\Temp\\pip-install-q7gocxf3\\dlib_ba1eccb06b884bc4a89365e82ab2b34f\\build\\lib.win-amd64-3.10', '-A', 'x64']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> dlib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Hi I am trying to install dlib via cmake but I keep getting error: legacy-install-failure here is the full readout (I have replaced my actual user name with USER)
>C:\Users\USER->pip install dlib
Collecting dlib
Using cached dlib-19.23.1.tar.gz (7.4 MB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib ... error
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [73 lines of output]
running install
C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\setup.py:129: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(cmake_version) < '3.1.0':
Building extension for Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\build\lib.win-amd64-3.10 -DPYTHON_EXECUTABLE=C:\Users\USER-\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\build\lib.win-amd64-3.10 -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 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\setup.py", line 222, in <module>
setup(
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\__init__.py", line 79, in setup
return distutils.core.setup(**attrs)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\core.py", line 148, in setup
return run_commands(dist)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
dist.run_commands()
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
self.run_command(cmd)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 1196, in run_command
super().run_command(command)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\command\install.py", line 68, in run
return orig.install.run(self)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\command\install.py", line 670, in run
self.run_command('build')
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 1196, in run_command
super().run_command(command)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 1196, in run_command
super().run_command(command)
File "C:\Users\USER-\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\USER-\AppData\Local\Temp\pip-install-q7gocxf3\dlib_ba1eccb06b884bc4a89365e82ab2b34f\setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\USER-\\AppData\\Local\\Temp\\pip-install-q7gocxf3\\dlib_ba1eccb06b884bc4a89365e82ab2b34f\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\USER-\\AppData\\Local\\Temp\\pip-install-q7gocxf3\\dlib_ba1eccb06b884bc4a89365e82ab2b34f\\build\\lib.win-amd64-3.10', '-DPYTHON_EXECUTABLE=C:\\Users\\USER-\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\USER-\\AppData\\Local\\Temp\\pip-install-q7gocxf3\\dlib_ba1eccb06b884bc4a89365e82ab2b34f\\build\\lib.win-amd64-3.10', '-A', 'x64']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> dlib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在PC上下载CMAKE可执行文件,安装并安装Visual Studio Build Tools为C ++安装CMAKE构建工具。使用Visual Studio构建工具安装CMAKE后,您需要从此github repo下载dlib wheel文件: https://github.com/tobyyosoba77777/computer-vision-vision-epencv-python-/tree/main/main/main/libraries
下载:下载:
dlib-12.22.99-cp39-cp39-win_amd64.whl
和下载:
dlib-129.22.99.win-amd64-py3.9.exe
在PC上安装.exe文件,重新启动(不需要)并打开下载的.WHL文件的当前目录,并将其保存在您的PC中python/ anaconda端子/ cmd:
例如:
然后输入:
“ pip install dlib-122.99-cp39-cp39-win_amd64.whl”
应该有效
download cmake executable file on your pc, install it and install cmake build tools for c++ from visual studio build tools. After installing cmake with visual studio build tools, you need to download dlib wheel file from this github repo: https://github.com/Tobyyosoba777/Computer-Vision-OpenCv-Python-/tree/main/Libraries
download:
dlib-19.22.99-cp39-cp39-win_amd64.whl
and download:
dlib-19.22.99.win-amd64-py3.9.exe
install the .exe file on your pc, restart it(not necessary) and open the current directory of the downloaded .whl file where it is saved on your pc in your python/anaconda terminal/ cmd
for example:
then input:
"pip install dlib-19.22.99-cp39-cp39-win_amd64.whl"
that should work
dlib 文档说:
有了那个蜜蜂,他们很可能不会与安装程序一起运送预先编译的库,并且为了在Windows上使用它,您必须自己编译它,并且要编译它,您需要Visual Studio(Mingw或Clang或Clang不会工作)。
如果您不介意在系统中安装另一个Python实例,则可以使用Conda进行预编译DLIB。
Dlib documentation says:
With that beeing said, it's likely they don't ship precompiled library with their installers, and it order to use it on windows you have to compile it yourself, and to compile it you need Visual Studio (mingw or clang wont work).
If you dont mind installing another instance of python in your system, you can use conda to get precompiled dlib.