I cannot import a file into the terminal using Pyhton

Asked

Viewed 61 times

1

I have a very simple code in python version 3.9.0. When I enter the terminal and folder where the file is saved I try to execute the following command in the file name import terminal and an error appears:

import : O termo 'import' não é reconhecido como nome de cmdlet, função, arquivo de script ou programa operável. Verifique a grafia do nome ou, se um caminho tiver sido incluído, veja se o caminho está correto e tente novamente.
No linha:1 caractere:1

+ import area_circunferencia_v1
+ ~~~~~~
+ CategoryInfo          : ObjectNotFound: (import:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

The code is called area_circunferencia_v1.py and goes below:

# ! python
from math import pi

def circulo(raio):
    return pi * float(raio)**2


if __name__ == '__main__':
    raio = input('Informe o raio:')
    area = circulo(raio)
print('Área do círculo: ', area)
  • 1

    If you are trying to execute a . py code from the terminal(cmd) use: python area_circumferencia_v1.py

  • Shebang does not work directly on Windows. You must open the shell file with Posix support for shebang or else associate extension *.py with the interpreter.

  • in the installation was set the environment variables, cmd when typing python enters the interactive shell tried to use Idle to see if it works well ?

  • It is trying to run the file automatically by double click.

  • Jeferson.Charlie hasn’t tried yet, I’ll try!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.