Visual Studio: missing Python file when trying to import the language into a C++ project.

Cheeseburger 1 Reputation point
2021-12-17T20:34:38.747+00:00

Hello, I am a student trying to learn how to get Python and C++ to function together via Visual Studio. This week, I encountered a bit of a technical problem with Visual Studio and Python. I have tried finding solutions on my own, but I cannot seem to find the information that I need to resolve it. I was hoping that someone here might be able to provide some insight.

At first, my issue would seem to be obvious. The file 'python310.dll' is simply missing. Yet, I do not think that it is. I have reinstalled Python multiple times, including both the 64-bit and 32-bit versions. I have also tried rolling back Python to a prior version, but it did not resolve my issue. Visual Studio continues to report that the file is missing.

My only guess is that my paths have been improperly setup to import Python into my C++ project. As I understand it, I need two paths to get functionality - the include folder and the library path. These paths, found at: properties/VC++Directories, match what my instructor has requested. The result, however, is an error from Visual Studio when compiled.

Below is a screenshot of both my paths and the error returned by Visual Studio:

158692-path-screenshot.jpg

Could anyone possibly offer insight into how I have errored in setting this project up? I am at my wits end at trying to solve this myself.

Developer technologies C++
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Cristian SPIRIDON 4,486 Reputation points Volunteer Moderator
    2021-12-19T11:19:54.27+00:00

    Hi,

    It may be that Python 3.10 is not found.

    Can you try to install it from following link and see if that fix the issue?

    https://www.python.org/downloads/release/python-3100/

    Hope this helps!

    0 comments No comments

  2. Minxin Yu 13,501 Reputation points Microsoft External Staff
    2021-12-21T03:22:59.677+00:00

    Hi, @Cheeseburger

    Here are some steps to fix the problem for your reference:

    1. Install python from the link provided by CristianSPIRIDON72. E.g. Recommended version.
    2. Try to create the project in VS 2022.
    3. Copy the python310.dll (you can find it in the Python310 folder) to C:/Windows/System32 folder. This fixed my same problem.

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.