"Python" encountered a simple answer to "Error:microsoft Visual C + + 9.0 is required" When installing Python packages

Source: Internet
Author: User

Brief answer

Install scrapy under Windows with PIP as an error,

Error:microsoft Visual C + + 9.0 is required (unable to find Vcvarsall.bat). Get it from Http://aka.ms/vcpython27

Open http://aka.ms/vcpython27 will jump to http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266

Download the installation package (Vcforpython27.msi, 83Mb) back to install to fix the problem

Microsoft Visual C + + Compiler for Python 2.7

A more reasonable solution:

When Python installs certain modules through PIP or source code, the modules contain C/+ + source codes, and the installation process calls the local compiler to compile them. The error message I installed under the Windows platform was "Error:microsoft Visual C + + 9.0 is required (unable to find Vcvarsall.bat). Get it from http://aka.ms/vcpython27 "can see the error is because the VC version is not found, the corresponding is vs2008, of course, a workaround is to install the version, but I have installed vs2015, so I need to modify the default configuration.

Solution Solutions

Method One:

    • First determine the version number of your own installation VS, you can view the registry, under Hklm\software\wow6432node\microsoft\visualstudio\,

      There will be more than one child of the digital card header, only the installed will have the corresponding INSTALLDIR entry, you can see that I installed the VS version is 14.0;

    • Open the Python installation directory/lib/distutilsmsvc9compiler.py file, locate the Find_vcvarsall function, and at the beginning of the function, add
      Version = the number above, which is added as "Version = 14.0", so that you can use the

def find_vcvarsall(version):    """Find the vcvarsall.bat file At first it tries to find the productdir of VS 2008 in the registry. If that fails it falls back to the VS90COMNTOOLS env var. """ version = 14.0 ##添加这行 vsbase = VS_BASE % version ... ... 
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

Method Two:
This method is simpler, adding an item vs90comntools to the environment variable, with the value "vs Installation path \common7\tools",

Reopen the command-line program to use it.

"Python" encountered a simple answer to "Error:microsoft Visual C + + 9.0 is required" When installing Python packages

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.