Permission denied for Python script using Bash?

后端 未结 3 1366
野性不改
野性不改 2020-12-19 09:22

I am new to Ubuntu... I am trying to run my first simple python program \"Hello World\" ... After running following commands in terminal

1. chmod +x filename         


        
3条回答
  •  盖世英雄少女心
    2020-12-19 09:31

    Do you have the appropriate incantation at the top of your python file? e.g.,

    #!/usr/bin/python (or alternatively #!/usr/bin/env python)

    Just to clarify, chmod +x only makes a file executable, it doesn't run it.

    And I'm assuming your script looks like nothing more complex than this:

    #!/usr/bin/env python
    print 'hello world'
    

提交回复
热议问题