I installed opencv with all dependencies. After the installation I tried to import matplotlib for a simple example.
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.
What can I do to install matplotlib?
Looks like your user doesn't have the permission to install packages in your system (for all users). Here's how to fix this problem for Linux, macOS and Windows.
From your terminal, you can install the package for your user only , like this:
pip install <package> --user
OR
You can use su
or sudo
from your terminal, to install the package as root
:
sudo pip install <package>
From the Command Prompt, you can install the package for your user only , like this:
pip install <package> --user
OR
You can install the package as Administrator , by following these steps:
Run This Program As An Administrator
pip install <package>
I solved this issue by typing the following command,
pip install --user <package_name>
Example,
pip install --user tensorflow
NOTE: You should not enter your own username for this command. Please enter with '--user'.
尝试这个:
sudo pip install matplotlib
You don't have the permission to install a package globally, so you can use sudo pip install matplotlib
, but it isn't recommended.
The recommended way is using venv or virtualenv to create a virtual environment.
venv:
python3 -m venv <DIR>
source <DIR>/bin/activate
pip install matplotlib
Try this:
sudo pip install <xyz>
And/Or this:
sudo pip3 install <xyz>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.