1

I am new with OSX and getting familiar with file structures in this environment. My .bash_profile file looks like this:

# Setting PATH for EPD_free-7.3-2
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH

My scripts are in several directories, for example:

/Users/LMS/Documents/pydata-book
/Users/LMS/Documents/python_scripts

What I would like to do is open my terminal, type the name of the script (for example myscript.py), and be executed, just like one would do by specifying an association of *.py files with Python, in a windows environment.

Anybody out there could help me accomplish this with a mac?

Thanks

Luis Miguel
  • 5,057
  • 8
  • 42
  • 75
  • possible duplicate of [Adding a path to the .bashrc file?](http://stackoverflow.com/questions/13631173/adding-a-path-to-the-bashrc-file) – tripleee Jan 03 '13 at 14:27

1 Answers1

3

Try putting this in your .bash_profile instead:

# Setting PATH for EPD_free-7.3-2
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/Users/LMS/Documents/pydata-book:/Users/LMS/Documents/python_scripts:${PATH}"

export PATH

Basically, you put the directories that contain the executable files you want, separated by ':'

KaeruCT
  • 1,605
  • 14
  • 15
  • Thank you. I did what you indicated and when I try to run my script from terminal by typing myscript.py, I get this -bash: /Users/LMS/Documents/pydata-book/myscript.py: Permission denied – Luis Miguel Jan 03 '13 at 14:42
  • 1
    I think you need to make the scripts executable, go to the directories with the scripts and do `chmod +x *.py` – KaeruCT Jan 03 '13 at 14:45