Build under Windows Cross-VC version. PYD extension (extension) module

Source: Internet
Author: User
Tags cuda toolkit visual studio 2010

Under Windows, the official recommendation is to compile the extension with the same Visual Studio version as the one that compiled Python itself, and now the more commonly used versions of Python correspond to the following Visual Studio:

Python 2.7-visual Studio 2008 (9)

Python 3.3 & 3.4-visual Studio 2010 (10)

Python 3.5-visual Studio 2015 (14)

Recently installed a Python 3.5, need to compile fast r-cnn python extension module, the computer installed Visusal Studio version only 2013, and compiled fast R-CNN and its dependencies required Cuda Toolkit currently does not support visual Studio 2015. Run the Python setup.py build directly with an error indicating that the Vcvarsall.bat was not found.

Workaround:

To edit the Python installation directory/lib/distutils/_msvccompiler.py, search for this line:

If version >= and version > best_version:

Here 14 is the minimum version (i.e. 2015) of Visual Studio installed in the Distutils automatic search system, modified to 12 (i.e. 2013), save, run the Python setup.py build again, successfully start compiling, and finally error in the link stage, Tip The library file could not be found Ucrt.lib

This ucrt.lib is the product of Visual C + + 2015 for the C language runtime, corresponding to the previous version of Visual C + + MSVCRT.lib, the solution is very simple, open the VC installation directory/lib, Locate MSVCRT.lib, copy one and rename it to Ucrt.lib, run Python setup.py build again, and compile successfully.


This article is from the "wdx04" blog, make sure to keep this source http://wdx04.blog.51cto.com/288327/1766199

Build under Windows Cross-VC version. PYD extension (extension) module

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.