LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-21-2009, 02:09 AM   #1
trist007
Member
 
Registered: May 2008
Distribution: Slackware
Posts: 991

Rep: Reputation: 56
How do I add python to the PATH...


Python command is in /usr/bin and I have /usr/bin in my $PATH. I want to be able to run

./program.py

instead of having to do

python program.py

What do I need to do?
 
Old 03-21-2009, 02:12 AM   #2
vindoan
LQ Newbie
 
Registered: Mar 2009
Posts: 23

Rep: Reputation: 17
Do you have the command directive on the first line of the python script?

#!/usr/bin/env python

Have you set the execute bit on the file?

chmod +x file.py

Cheers
 
Old 03-21-2009, 09:11 AM   #3
trist007
Member
 
Registered: May 2008
Distribution: Slackware
Posts: 991

Original Poster
Rep: Reputation: 56
Yes I have

#!/usr/bin/python

Yes I have the execute bit on

The program runs if I do

sudo python ./program.py

But I want to be able to do

sudo ./program.py
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python: Can you add text to an image in python? BrianK Programming 2 04-03-2008 03:56 PM
Do you add to the path line or make a new path in /etc/profile? M$ISBS Linux - Newbie 2 12-13-2006 02:14 PM
Python upgradation,setting compiler $PATH jared78 Linux - Newbie 9 01-20-2006 12:12 AM
Python Add Image Gerardoj Programming 2 11-09-2003 04:24 PM
How do I change python search path Giallo998 Linux - Software 1 10-22-2003 07:27 PM


All times are GMT -5. The time now is 11:16 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration