News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

2024-11(8)

Solve the error of Python installing third-party libraries: Microsoft Visual C++ 14.0 is required

posted on 2023-05-21 18:09     read(285)     comment(0)     like(9)     collect(1)


error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

When we install most of the python packages , it can be solved by pip install or conda install, but some packages cannot be installed. For example, mine will report that Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools" error.

Cause:

The reason for this is that part of the code in the library installed by pip is not python but written in C++ and other codes. We need to compile and install this type of library when we install it.

  1. Install Microsoft C++ Build Tools software, but this method is too cumbersome for many people. (Not recommended)
  2. Install the library file compiled by others. In pip, the suffix of this compiled file is .whl (recommended)
  3. Conda specifies channel configuration (recommended)

1. Install Microsoft C++ Build Tools software

        Seeing an error in the installation package, it is really laborious to install. Also big.

2. whl pip install solution

        We can find .whlthe files corresponding to the library. Here we give a summary download site.whl for files

https://www.lfd.uci.edu/~gohlke/pythonlibs/orhttps://pypi.org/project/  】_ _

Wheel Download

We need to judge based on the file name, here we analyze the following file names:

lxml4.9.0‑cp311‑cp311‑win_amd64.whl

        Among them, cp311 represents the CPython 3.11 version, win represents the windows system, and amd64 represents the 64-bit system. For example, I use Python 3.11 downloaded from the official website and my operating system is 64-bit Windows, so I can download this file and install it.

Type the following command:

pip install lxml‑4.9.0‑cp311‑cp311‑win_amd64.whl

The corresponding library can be installed.

3. Conda specifies the installation solution

conda install libpython m2w64-toolchain -c msys2

simple right?

Main reference: stackoverflow

4. Supplements
It seems that I can't think of other things for the time being. I have been tortured by this problem all night. Using linux will not cause such problems. Using windows is just to adapt, haha, waste of time.

5. Remarks
When solving the problem of Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools, I have already used the downloaded .whl package for pip installation, and there is no problem at present. I need to use conda later install libpython m2w64-toolchain -c msys2



Category of website: technical article > Blog

Author:gfg

link:http://www.pythonblackhole.com/blog/article/25338/bf762b59f40aa6fa05c4/

source:python black hole net

Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.

9 0
collect article
collected

Comment content: (supports up to 255 characters)