Home>

Hi, I'm currently creating and running an environment with some things I want to try with Python.
So at this point, install Python 3.7, 3.8, Anaconda 2020.11 in Windows 10-64bit environment
It can be executed from the command prompt through the path.

And I want to try using IDE, install Visual Studio 2019 Community and follow the tutorial
I have installed the necessary modules.
And it would be nice until I created a Python project and could display the edit screen ...

Written from the beginning in the Python project source
> print ('Hello world')
Even if I run this program, the command prompt is displayed for a moment.
It ended immediately

In the output window
>The program'[15120] python.exe' exited with code 0 (0x0).
Is only displayed.

After trying screen capture several times, at the command prompt
c: \ program files \ Microsoft Visual Studio \ shared \ python37_64.python.exe
It seems that "Hello world" is not displayed even though the program "Hello world" is running.

Then try setting breakpoints
The situation does not change even if you put a code that waits for character input after the print statement.
A command prompt will be displayed for a moment and the process will end.

In the window "Python 3.8 (64bit) interactive" at the bottom of the screen of Visual Studio
>>> print ('Hello world')
When you enter
Hello world
Is displayed, so I think that it can be executed on the interactive screen.
I just can't execute the code in execution.
I thought it was an environmental problem, and even if I switched to Python 3.7, 3.8, Anaconda 2020.11, the situation did not change.
I think it's some kind of setting or environment, but if anyone can think of it
I would appreciate any hints and advice.

  • Answer # 1

    I think I understand
    Python execution in Visual Studio seems to be useless unless it is IronPython
    It seems that you need to obtain and install IronPython separately
    When I run IronPython after installing it
    'Hello world' is displayed.
    Breakpoints also seem to work
    However, it seems that there are only 2.7 series at present
    I don't have the 3.7 or later I want to use, so I'd like to find another IDE.

    https://apicodes.hatenablog.com/entry/IronPython

    IronPython 2.7.11
    https://github.com/IronLanguages/ironpython2/releases/