I am a user of python under mac and need to work now on a windows system.
I have installed Python35 for windows in Powershell, the command py --version and python --version provides me "Python 3.5.2".
I want to run a python script in Powershell and have tried : py file.py python file.py py .\file.py python .\file.py
and have the following :
python : File ".\file.py", line 1
Au caractère Ligne:1 : 1
+ python .\file.py
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( File ".\file.py", line 1:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
SyntaxError: Non-UTF-8 code starting with '\xff' in file .\file.py on line 1, but no encoding declared; see
http://python.org/dev/peps/pep-0263/ for details
As for .\file.py it opens me a black window that closes within 1 second.
Interestingly, when doing python or py it outputs the python idle but powershell is blocked and I cannot use it either in powershell.
Now, I already looked at
cannot run python script file using windows prompt
Run python script inside powershell script
As well as I tried to add the Python Path in Powershell and manully in the "Advance system" interface of windows.
By the way my file.py contains a simple print("hello")
What am I doing wrong?
echo "print('hello')" > file.pythen runpython3 file.py. What happen is (being a newbie), I did in powershellecho "print('hello')" >> file.pywhich I guess have add an invisible character that it was complaining about. Creating a brand new file from the editor on the other hand worked perfectly fine in the end.