반응형

 

 

 

In Python, the error message "Defaulting to user installation because normal site-packages is not writeable" usually appears when you try to install packages without having the necessary permissions to write to the system-wide site-packages directory.

Occurrence

This commonly occurs in virtual environments or when you lack administrative access.

Error-resolving approaches

To resolve this error, you can use the following approaches:

  1. Using a virtual environment

First, create a virtual environment using tools like venv or virtualenv using this command in your terminal:

 
 

Now, activate the virtual environment using these commands:

 
 

Finally, install packages within the virtual environment using this command in your terminal:

 
 

This way, you will have write access to the virtual environment's site-packages directory without requiring system-wide permissions.

  1. Specifying a user installation

You can install the package in the user’s local site-packages directory using this command:

 
 

Use the --user flag when installing packages to specify a user installation instead of a system-wide installation.

  1. Using a package manager

If you're using Linux, you can use system-wide package management like apt or yum to install Python packages. Typically, administrative rights are needed for this.

 
 

Hence, these approaches provide you with the necessary write permissions to install packages in a controlled and isolated manner.

 

 

 

ref : https://www.educative.io/answers/how-to-resolve-normal-site-packages-is-not-writable-in-python

반응형

+ Recent posts