Tengo en la parte superior del archivo #!/usr/bin/env python
. Entonces debería funcionar cuando ejecuto el archivo? Pero no es así. Funciona cuando uso python file.py
aunque#!/Usr/bin/env python: Obteniendo comando no encontrado y Permiso denegado
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
class App1:
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.show()
def main(self):
gtk.main()
if __name__ == "__main__":
app = App1()
app.main()
Python Esto es lo que sucedió:
[email protected]:/labs/projects/learnPython$ app1.py
app1.py: command not found
[email protected]:/labs/projects/learnPython$ ./app1.py
bash: ./app1.py: Permission denied
[email protected]:/labs/projects/learnPython$ ll
total 12
drwxr-xr-x 2 jiewmeng jiewmeng 4096 2011-07-16 22:08 ./
drwxr-xr-x 4 jiewmeng jiewmeng 4096 2011-07-16 21:45 ../
-rwxrwxr-x 1 jiewmeng jiewmeng 256 2011-07-16 22:05 app1.py*
¿Se ejecuta el intérprete python si simplemente hace '/ usr/bin/env python' desde la línea de comando? –
Obtiene 'command not found' porque' .' no está en '$ PATH' (ejecute' PATH = $ PATH :. app1.py' y ese error en particular no ocurrirá). –
@jiewmeng - ¿Has resuelto esto? – mac