Python third-party library numpy installation error solution

Python third-party library installation error solution

When installing Python third-party libraries, sometimes you may encounter various errors, so here is a possible error report and its solution.

error message

When installing numpythe library , the following error message may appear:

RuntimeError: Broken toolchain: cannot link a simple C program

solution

This error message is caused by the lack of some necessary compilation tools or libraries. To solve this problem, you need to look at the specific error message to determine which components are missing.

Solution in Linux system

If you are using a Linux system, you can use the following command to view specific error messages:

$ pip install numpy==1.20.0 -v

In the output, you may see some error messages such as:

running build
running config_cc
unifing config_cc, config, dist_info
compiling '_configtest.c':
#error "unsupported: no compiler found, please install the developmenttools"

This error message indicates that the compilation tool is missing, gccwhich can be solved :

$ sudo apt-get install gcc

If your system is a Red Hat system, you can run the following command:

$ sudo yum groupinstall 'Development Tools'

Solution in Windows system

If you're using Windows, you can download and install these tools from Microsoft's Visual Studio Build Tools page.

After installation, you may need to set environment variables, run the following command at the command prompt:

C:\> setx PATH "%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64"

This command assumes that your installation directory is C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC. If your installation directory is different, you need to modify it according to the actual situation.

in conclusion

This is a possible Python third-party library installation error and its solution. You may face different issues while installing Python third-party libraries, but by looking at the error messages and following the corresponding solutions step by step to resolve the issue, you can successfully install the required third-party libraries.
Python third-party library numpy installation error solution

Guess you like

Origin blog.csdn.net/qq_45451150/article/details/130945497