求解:导入python本地包face_recognition有错误但是其他一些没问题

King5_12 2018-12-03 10:07:59
导入python中face_recognition包时导入不进去 试了其他几个包时都没有问题 导入时的显示就像这样
那个写的
Command "e:\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Shinelon\\AppData\\Local\\Temp\\pip-install-asn7r7wx\\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\Shinelon\AppData\Local\Temp\pip-record-8u7s17os\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Shinelon\AppData\Local\Temp\pip-install-asn7r7wx\dlib\
然后我看了一下,上面的有些路径我都找不到 在c盘里我找到Temp文件夹后,后面的文件就都找不到了
然后我python是安装在e盘的。
...全文
612 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
blog_1103 2019-06-19
  • 打赏
  • 举报
回复
想用人脸识别模块face_recognition必须先装好dlib模块
qq_43126760 2019-06-19
  • 打赏
  • 举报
回复
降级命令为conda install python=3.6 试试
夏虫EG 2018-12-22
  • 打赏
  • 举报
回复
我在自己机子上安装了一下这个包,安装过程中发生了上述报错,报错内容中有以下两句:
1、package init file 'dlib\__init__.py' not found (or not a regular file)
2、FileNotFoundError: [WinError 2] 系统找不到指定的文件
根据这两个报错猜测应该是dlib安装包的版本问题或者是pip命令的权限问题(有时需要用管理员身份)。
再次查看报错后发现有个很明显的提示: CMake must be installed to build the following extensions: dlib。所以需要先安装CMake包:pip install CMake。安装后再次安装face_recognition仍然报错,提示是CMake命令的一些参数存在问题(不需要指定运行平台,但命令中却指定了),不过这个问题应该可以在网上找到一些解决方法,稍后我再研究一下。

详细报错内容(因为这个目录是研究Electron的,临时用来查看一下这个问题,所以不要纠结目录路径。。。):
D:\Workspace\Electron\my-first-app>venv\scripts\activate
(venv) D:\Workspace\Electron\my-first-app>pip install face_recognition
Collecting face_recognition
Downloading https://files.pythonhosted.org/packages/3f/ed/ad9a28042f373d4633fc8b49109b623597d6f193d3bbbef7780a5ee8eef2/face_recognition-1.2.3-py2.py3-none-any.whl
Collecting Click>=6.0 (from face_recognition)
Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting dlib>=19.7 (from face_recognition)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/35/8d/e4ddf60452e2fb1ce3164f774e68968b3f110f1cb4cd353235d56875799e/dlib-19.16.0.tar.gz (3.3MB)
Collecting Pillow (from face_recognition)
Downloading https://files.pythonhosted.org/packages/bd/39/c76eaf781343162bdb1cf4854cb3bd5947a87ee44363e5acd6c48d69c4a1/Pillow-5.3.0-cp36-cp36m-win_amd64.whl (1.6MB)
Collecting face-recognition-models>=0.3.0 (from face_recognition)
Downloading https://files.pythonhosted.org/packages/cf/3b/4fd8c534f6c0d1b80ce0973d01331525538045084c73c153ee6df20224cf/face_recognition_models-0.3.0.tar.gz (100.1MB)
Collecting numpy (from face_recognition)
Downloading https://files.pythonhosted.org/packages/51/70/7096a735b27359dbc0c380b23b9c9bd05fea62233f95849c43a6b02c5f40/numpy-1.15.4-cp36-none-win_amd64.whl (13.5MB)
Installing collected packages: Click, dlib, Pillow, face-recognition-models, numpy, face-recognition
Running setup.py install for dlib: started
Running setup.py install for dlib: finished with status 'error'
Complete output from command d:\workspace\electron\my-first-app\venv\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\sun\\AppData\\Local\\Temp\\pip-build-d4o858v9\\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\sun\AppData\Local\Temp\pip-94mf5i7j-record\install-record.txt --single-version-externally-managed --compile --install-headers d:\workspace\electron\my-first-app\venv\include\site\python3.6\dlib:
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:\Users\sun\AppData\Local\Temp\pip-build-d4o858v9\dlib\setup.py", line 118, in get_cmake_version
out = subprocess.check_output(['cmake', '--version'])
File "C:\Program Files\Python36\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\Program Files\Python36\lib\subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Program Files\Python36\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Program Files\Python36\lib\subprocess.py", line 997, in _execute_child
startupinfo)


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\sun\AppData\Local\Temp\pip-build-d4o858v9\dlib\setup.py", line 257, in <module>
'Topic :: Software Development',
File "C:\Program Files\Python36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Program Files\Python36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Program Files\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "d:\workspace\electron\my-first-app\venv\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Program Files\Python36\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Program Files\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Program Files\Python36\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Program Files\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\sun\AppData\Local\Temp\pip-build-d4o858v9\dlib\setup.py", line 127, in run
cmake_version = self.get_cmake_version()
File "C:\Users\sun\AppData\Local\Temp\pip-build-d4o858v9\dlib\setup.py", line 123, in get_cmake_version
"\n*******************************************************************\n")
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: dlib
*******************************************************************


----------------------------------------
Command "d:\workspace\electron\my-first-app\venv\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\sun\\AppData\\Local\\Temp\\pip-build-d4o858v9\\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\sun\AppData\Local\Temp\pip-94mf5i7j-record\install-record.txt --single-version-externally-managed --compile --install-headers d:\workspace\electron\my-first-app\venv\include\site\python3.6\dlib" failed with error code 1 in C:\Users\sun\AppData\Local\Temp\pip-build-d4o858v9\dlib\
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
notback 2018-12-19
  • 打赏
  • 举报
回复
不好意思,从来都是用pip安装包的,这个没碰到过。
看样子好像tokenize安装的有问题啊。
试一试用pip重装一下tokenize
King5_12 2018-12-03
  • 打赏
  • 举报
回复
顶顶顶 求大佬帮助

37,719

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧