Home >Backend Development >Python Tutorial >Why is \'Microsoft Visual C 14.0 Required\' for lxml Installation on Windows and How Can I Fix It?

Why is \'Microsoft Visual C 14.0 Required\' for lxml Installation on Windows and How Can I Fix It?

Barbara Streisand
Barbara StreisandOriginal
2024-11-21 08:09:09370browse

Why is

Lxml Installation Error on Windows: Resolving "Microsoft Visual C 14.0 Required"

When attempting to install the lxml package using pip in Windows 10, users may encounter the error message "Microsoft Visual C 14.0 is required." This issue arises despite potentially having Visual Studio 2015 installed.

To resolve this issue, follow these steps:

  1. Verify Visual Studio C Compiler Installation: Ensure that you have installed the C compiler when installing Visual Studio. Open the Visual Studio setup under Programs and Features and navigate to Programming Languages -> VC . Confirm that the option is ticked.
  2. Update Visual Studio 2015: Check for any available updates for Visual Studio 2015. Installing updates may include missing components necessary for lxml installation.
  3. Reinstall Visual Studio C Build Tools: If the issue persists, try manually downloading and installing the Visual Studio C Build Tools from Microsoft's official website.
  4. Enable Visual C Toolkit for Python: Open a Visual Studio Command Prompt as an administrator and run the following command:

    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86

    This command will temporarily set the environment variables required by Python to build the lxml extension.

  5. Install lxml Again: After completing the above steps, attempt to install lxml through pip again using:

    pip install lxml

By following these steps, you should be able to successfully install lxml without encountering the "Microsoft Visual C 14.0 required" error.

The above is the detailed content of Why is \'Microsoft Visual C 14.0 Required\' for lxml Installation on Windows and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn