Не могу не как понять как установить библиотеку Python.h

Alex 0 Reputation points
2023-07-28T15:33:07.32+00:00

Well, I need to install the Python.h library but I can't figure out how to install it in visual studio, some videos I couldn't find that would solve my problem.

The goal is to make a project that the main part of the code is written in C++, and a small code in Python, how to do it I do not know, could you tell me how to install the library Python.h or some other option that would help to realize my idea.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,887 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,636 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Minxin Yu 11,026 Reputation points Microsoft Vendor
    2023-07-31T02:27:48.3066667+00:00

    Hi,

    It is recommended to install the latest python from the official website.

    User's image

    enter image description here

    enter image description here

    1. The installation location is default at
    C:\Users\Administrator\AppData\Local\Programs\Python\Python311
    

    Python.h is in folder:

    C:\Users\Administrator\AppData\Local\Programs\Python\Python311\include
    
    1. In addition, you need to add python311_d.lib as a dependency in your C++ project

    Folder:

    C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs
    
    1. Add the folder C:\Users\Administrator\AppData\Local\Programs\Python\Python311 as the system environment path.

    Or put python311_d.dll in the same folder as your generated exe. python311_d.dll is in folder C:\Users\Administrator\AppData\Local\Programs\Python\Python311.

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.