Go Back   Velocity Reviews > Newsgroups > Python
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Python - Re: PYTHONPATH on Mac 10.5

 
Thread Tools Search this Thread
Old 02-26-2009, 07:09 AM   #1
Default Re: PYTHONPATH on Mac 10.5


+1 for site packages and standard shebang, still lets you launch with
python first followed by .py file or <big long path to a specific
python> followed by .py file

also for some clues, just open up a terminal in your Mac OS X computer
and check out your exports your PATH will be different depending on
all the software and development environments you may or may not be
using on your Mac, in particular:

declare -x PATH="/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"

declare -x PYTHONSTARTUP="/Users/pythonnutter/.pythonstartup"

for the ultra curious, my custom python startup:

$cat .pythonstartup
# python startup file
import readline
import rlcompleter
import atexit
import os
# tab completion
readline.parse_and_bind('tab: complete')
# history file
histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file, histfile)
del os, histfile, readline, rlcompleter



On Windows you don't have much control in standard batch files but the
way I keep my Windows box (at work mind you, none at home)
multi-python'd

is I configure the environment for Framework 2.5.4, and all the path
environment variables are configured for the standard directory and
the scripts subdirectory.

in 25's scripts is go26.bat which just pre-pends the 2.6.1 path on the
head of PATH, and of course a go3.bat that pre-pends in 3.0.1

if you want to get fancy, since there is no pop in batch files that I
know of, you could drop a .py script in to read in PATH, pop off two
entries and modify the environment PATH so you fall back down the tree
(might need some list reversing in there to finish the massaging for
pops)

most times I get by with just exiting the terminal session in windows
and a new cmd session will once again take on the defaults for 2.5.4


Python Nutter
  Reply With Quote
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46