using #!/usr/bin/env python3 shebang with Windows

前端 未结 3 1705
野的像风
野的像风 2021-01-18 02:18

I\'m trying to run a Python script from the command line as a command on Windows -- so no usage of \"Python\" or \".py\". If my script is named \"testing.py\", I am attempti

3条回答
  •  太阳男子
    2021-01-18 02:54

    You can use shebang in windows by setting the path of your interpreter as the first line in the file(you will see a marker on VSCode that says 'set as interpreter ' on that line). Using windows 10,Python version 3.9 see example:

    #!C:/Users/waithira/AppData/Local/Programs/Python/Python39/python.exe 
    print('hello world')
    

提交回复
热议问题