pycharm terminal installs a third-party library and reports Defaulting to user installation because normal site-packages is not writeable

System: win10 22H2, win11, Windows server 2003
Software: pycharm
System software: command line (administrator mode)


foreword

        When installing a third-party library in pycharm terminal pip, I found that a warning command was suddenly reported. Today, I will analyze the reason with you from the system level. Do it without modifying any folder permissions.

Defaulting to user installation because normal site-packages is not writeable

The reported warning⚠picture is as follows:
Error graph
        It can be seen that there are many environments that can satisfy the installation, but it cannot be realized due to the problem of Windows system permissions.


1. Solution

        I read that the reported error is not serious, it is just a very basic problem, and I thought of several solutions. Here are three. The first is to directly enter the site-packages where third-party files are stored in the system disk and change the folder permission from read-only to read-write. The second way is to enter the command line (administrator mode) to solve it. The third is the library installation that comes with pycham. Try them one by one to see which one works.

2. Reason Analysis

1. Windows system level

        Since the installation of python3.8 entered the C disk, the files in the system disk are all read-only to ensure data security. Secondly, to prevent us from deleting third-party library files by mistake, which will cause the project to fail to run. If the company is running a larger project, it is a serious accident to delete the library file by mistake ! ! ! So I do not recommend this method ! ! ! ! !

2. Use the terminal command line method

        Enter the relevant command

pip install request

error
Still failed. . . Administrator's powershell still fails

3. Directly use the library installation method of pycharm

Attach a picture,
pycharm
you can see that the third-party library file we want is finally installed, and the report successfully means that the installation is successful!


Summarize

        This article only provides a way to solve the problem, I hope it will be helpful to you! If you have any questions, you can leave a message in the comment area, let's work together!

Guess you like

Origin blog.csdn.net/weixin_44568751/article/details/129059197