An error is reported when installing the package directly in pycharm, but it can be installed through the terminal. Error non zero exit code (2)

An error is reported when installing the package directly in pycharm, but it can be installed through the terminal

The problem description is shown in the figure below:

Error content: non zero exit code (2) direct installation will report the following error , but you can use the command to install in the terminal in pycharm, but it is too troublesome to install every time, which is not applicable to problem analysis

The PIP I use here is version 21.3.1. I checked my previous projects and found that pip21.2.4 can be installed normally without error, so I reduced the PIP version of this project to pip21.2.4. However, I don’t know the specific reason why pip21.3.1 can’t be used. The problem is solved

    enter the directory where the project environment is located
    open windows PowerShell in administrator mode and enter the directory where the environment is located. Use python.exe in the project to run the command - M PIP install PIP = = 21.2.4

    The goal here is to use the python execution command in the project instead of the global Python execution command . Enter pycharm to view the PIP version installation package . If there is no accident, it can be solved. I solved the problem in this way. At this time, if you like, you can upgrade PIP again. I try to upgrade pip to 21.3.1 again, which can be installed normally

    Reference blog

      https://blog.csdn.net/CNWorldisyourFC/article/details/110468251?utm_ medium=distribute.pc_ relevant.none-task-blog-title-2& spm=1001.2101.3001.4242. https://blog.csdn.net/weixin_ 51119842/article/details/110469060.

Read More: