/usr/bin/env: ‘python3\r’: No such file or directory [duplicate]

The problem are your line ending characters. Your file was created or edited on a Windows system and uses Windows/DOS-style line endings (CR+LF), whereas Linux systems like Ubuntu require Unix-style line endings (LF).

There is a simple tool that can convert the two different styles for you called dos2unix.

Install it by running

sudo apt install dos2unix

After that, you can convert files in either direction using one of the commands

dos2unix /PATH/TO/YOUR/WINDOWS_FILE
unix2dos /PATH/TO/YOUR/LINUX_FILE

Example:

$ cat test.py 
#!/usr/bin/env python3
print("ok")

$ ./test.py 
/usr/bin/env: ‘python3\r’: No such file or directory
$ dos2unix test.py 
dos2unix: converting file test.py to Unix format ...
$ ./test.py 
ok

To also come back to what you tried first, the shebang line

#!/usr/bin python3

is of course wrong. It tries to execute the file /usr/bin with python3 and the filename of your script as arguments. This must obviously fail because /usr/bin is a directory and no executable file.