close

[Solved] “PermissionError: [Errno 13] Permission denied: ‘/usr/lib/python3.5/site-packages'” installing Django

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error “PermissionError: [Errno 13] Permission denied: ‘/usr/lib/python3.5/site-packages'” installing Django in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How “PermissionError: [Errno 13] Permission denied: ‘/usr/lib/python3.5/site-packages'” installing Django Error Occurs?

Today I get the following error “PermissionError: [Errno 13] Permission denied: ‘/usr/lib/python3.5/site-packages'” installing Django in python.

How To Solve “PermissionError: [Errno 13] Permission denied: ‘/usr/lib/python3.5/site-packages'” installing Django Error ?

  1. How To Solve “PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.5/site-packages'” installing Django Error ?

    To Solve “PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.5/site-packages'” installing Django Error You do not want to install your project libraries with sudo because it will install your libraries system wide

  2. “PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.5/site-packages'” installing Django

    To Solve “PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.5/site-packages'” installing Django Error You do not want to install your project libraries with sudo because it will install your libraries system wide

Solution 1

You could accidentally recreate virtualenv with Python2 by forgetting to put path to Python3 interpreter so when you execute pip3 it refers to system Python3.

Make sure that you use correct Python in your virtualenv and also make sure that you create virtualenv with pip (yes it’s the default option but we don’t know how you create your virtual environment).

Solution 2

here’s how I got my permission issue fixed without using sudo.

Install

  • Make sure you have virtualenv installed here
  • This is optional, but I also use virtualenvwrapper to use the workon command here, otherwise you can just source bin/activate from the virtualenv

Create Virtualenv

You do not want to install your project libraries with sudo because it will install your libraries system wide (which will run into issues when you have more than one project). Instead use virtualenvs like this:

$mkvirtualenv myenv --python=python3.5
$workon myenv
$pip3 install -r requirements.txt

This gets you setup by making your virtualenv ‘myenv’ and specifying which python you are using. You then activate the environment and are able to install your requirements file.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read