问题描述
我安装了具有所有依赖项的 opencv .安装后,我尝试导入 matplotlib 作为简单示例.
I installed opencv with all dependencies. After the installation I tried to import matplotlib for a simple example.
然后,当我尝试使用 pip install matplotlib
通过pip安装matplotlib时,出现以下错误:
Then I got the following error, when I tried to install matplotlib via pip with pip install matplotlib
:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/kiwisolver.cpython-35m-x86_64-linux-gnu.so'
Consider using the `--user` option or check the permissions.
如何安装 matplotlib?
What can I do to install matplotlib?
推荐答案
看起来您的用户没有权限在您的系统中安装软件包(适用于所有用户).这是在Linux,macOS和Windows上解决此问题的方法.
在终端上,您可以仅为您的用户安装软件包,如下所示:
From your terminal, you can install the package for your user only, like this:
pip install <package> --user
OR
您可以在终端中使用 su
或 sudo
来以 root
身份安装软件包::>
You can use su
or sudo
from your terminal, to install the package as root
:
sudo pip install <package>
Windows
在命令提示符下,您可以仅为您的用户安装软件包,如下所示:
pip install <package> --user
OR
OR
您可以以管理员身份安装软件包,具体步骤如下:
You can install the package as Administrator, by following these steps:
- 右键单击命令提示符图标
- 选择选项
以管理员身份运行此程序
- 运行命令
pip install
这篇关于通过安装matplotlib权限被拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!