问题
I tried to install dlib package in windows 7 using the below commands,
pip install dlib==19.18.0
and
python -m pip install https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz#sha256=8ca127253a0ca82a3d847148515f82ff2c504ed77a6385ec4f38c7f8e5360860
Download tar file and run python setup.py install.
I am getting the below error:
Collecting dlib==19.18.0
Using cached https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\admin\envs\api\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-hwgs8hc1\\dlib\\setu
p.py'"'"'; __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-hwgs8hc1\\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\Admin\AppData\Local\Temp\pip-wheel-5sltbyhe' --python-tag cp36
cwd: C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc1\dlib\
Complete output (55 lines):
running bdist_wheel
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.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc1\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8h
c1\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=c:\users\admin\envs\api\scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc
1\dlib\build\lib.win-amd64-3.6 -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/Admin/AppData/Local/Temp/pip-install-hwgs8hc1/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc1\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "c:\users\admin\envs\api\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\admin\envs\api\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
self.run_command('build')
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc1\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc1\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-hwgs8hc1\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Admin\\
AppData\\Local\\Temp\\pip-install-hwgs8hc1\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=c:\\users\\admin\\envs\\api\\scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEAS
E=C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-hwgs8hc1\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.
ERROR: Command errored out with exit status 1: 'c:\users\admin\envs\api\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Tem
p\\pip-install-hwgs8hc1\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-hwgs8hc1\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__fil
e__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Admin\AppData\Local\Temp\pip-record-3bbuo3ir\ins
tall-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\admin\envs\api\include\site\python3.6\dlib' Check the logs for full command output.
I need to install dlib version==19.18.0 or 19.19.0. I am using python 3.6.5 and pycharm. I need to install dlib without using anaconda. Please help me with this...
回答1:
Try this method :
Via Anaconda we can install the dlib.
Install the anaconda exe file from this link (https://www.anaconda.com/distribution/#download-section)
In Conda prompt, create an environment using this command
**conda create --name env_name python=3.7.0**
Then activate the env
**conda activate env_nam**e
Install dlib
**conda install -c conda-forge dlib=19.17**
来源:https://stackoverflow.com/questions/59453584/need-to-install-dlib-package-in-windows-7