

解决pip install x ERROR: Could not install packages due to an OSError…问题
source link: https://xushanxiang.com/pip-install-oserror.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

解决pip install x ERROR: Could not install packages due to an OSError…问题

在进行人脸数据训练时,执行Python文件,出现下面错误:
Traceback (most recent call last):
File "D:/microPythonCode/camera/trainer.py", line 47, in <module>
recognizer=cv2.face.LBPHFaceRecognizer_create()
AttributeError: module 'cv2.cv2' has no attribute 'face'
出现AttributeError: module “cv2” has no attribute “face”
,就需要安装opencv-contrib-python
库。
一般的安装方法如下:
pip install opencv-contrib-python
或者
pip install opencv-contrib-python -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
但是,下载150M左右的文件后,安装时出现的显眼的红色报错:
ERROR: Could not install packages due to an OSError: [Errno 2] No such file......
这个错误通常表示在尝试安装或升级包时,找不到特定的文件或目录。这可能是由于多种原因引起的,包括文件损坏、依赖关系问题或环境配置问题。
如果你遇到同样的问题,可以尝试我解决这个问题的方法:
(1)opencv-contrib
和opencv
必须具有完全相同的版本。
>pip list
...
numpy 1.19.5
opencv-python 4.5.1.48
packaging 21.3
pandas 1.1.5
...
>pip install opencv-contrib-python==4.5.1.48
...
Installing collected packages: opencv-contrib-python
Successfully installed opencv-contrib-python-4.5.1.48
...
(2)如果仍然出现错误,请更改了它们的版本。
Recommend
-
64
quelpa/quelpa master
-
19
OSError: [WinError 126] 找不到指定的模块。 1.问题描述...
-
10
Tutorial How To Install and Manage System Packages in Ansible Playbooks Ubuntu
-
6
Install Python packages from git repository with pipWhen it comes to packages probably every Python developer thinks of pypi. This is the most common way of distribution them in the ecosystem. But there...
-
5
解决 npm install 时遇到的 Error installing vscode.d.ts: Error: getaddrinfo ENOENT raw.githubusercontent.com 问题 本次手动安装一个 vscode 扩展。在对应目录下执行 npm install...
-
34
Install Tanzu Packages on Tanzu Kubernetes Clusters on VMware Cloud Director VMware Cloud Director enables Kubernetes-as-a-Service using C...
-
6
How To Use Pip (Simple Guide To Install, Update, Uninstall Packages)An Elite CafeMedia Tech Publisher
-
7
幻悠尘的小窝The quieter you become,the more you are able to hear.解决pip install安装非常慢[Errno 101] 网络不可达问题使用pip安装seaborn提示: sudo...
-
9
A shell script to download packages for, configure, build and install a GCC cross-compiler. · GitHub Instantly share code, notes,...
-
6
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK