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)
If you are trying to execute a . py code from the terminal(cmd) use: python area_circumferencia_v1.py
– Bernardo Lopes
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.
– Augusto Vasques
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 ?
– stack.cardoso
It is trying to run the file automatically by double click.
– Augusto Vasques
Jeferson.Charlie hasn’t tried yet, I’ll try!
– Clarice de Arruda Heringer Mes