4

What's the difference between these two folders on mac os x 8.5? I've installed the latest version of tcl and it was placed in my /usr/local/lib folder. However I have a tcl folder under /Library also. Should I install tcl in this folder instead?

I'm actually trying to use tk with python but python is complaining about the wrong arch for a tile dylib: /Library/Tcl/tile0.6/libtile0.6.dylib. This is why I built and inbstalled the latest versions of tk and tcl,

Why is python3 looking there instead of /usr/local/lib?

1 Answer 1

4

Think of /Library as Apple-sanctioned, and /usr/local/* as generally third-party installations performed in the terminal. Your Python install is likely the install that comes with your Mac as bundled by Apple. Therefore, it doesn't really know about libraries that you've installed yourself. You can set sys.path in your python apps to tell them where to load libraries from. You can also use sys.path to see what the default path is:

$> python
>>> import sys
>>> print sys.path

Another route you can also take is to use a third-party package management system to install all of your development versions of software to get more fine-grained control of what libraries you want installed. This also allows you to update to newer versions of libraries than what Apple provides. MacPorts and Homebrew are two such package management systems.

So, in your case, you are interested in Tk and Python. You could use MacPorts to install your own version of Python and Tk, and use those versions instead of the out-of-the-box versions. Because these packages are installed by the same package manager, the MacPorts version of Python will be aware of any other python libraries installed by MacPorts.

Using a package manager means that you'll need to do some things such as setting up your $PATH to use the software provided by the package manager, so be sure to read the docs and get a good understanding of what you'd be getting yourself into. :-)

2
  • I installed python3 myself but i didnt do it on the command line. When I run 'which python3', I get /Library/Frameworks/Python.framework/Versions/3.1/bin/python3. When I print sys.path, all of the directories listed are relative to /Library. No mention of /usr/local/lib.
    – Baz
    Mar 24, 2013 at 7:09
  • If you are developing just for your local machine, you can add your own entries to sys.path in your scripts. sys.path.insert(1,'/usr/local/lib'), or sys.path.append('/usr/local/lib'). This line should appear before your import statement. This makes your script less portable to other machines, though. Package management would be better. You can also define a PYTHONPATH environment variable to augment the default sys.path. Mar 24, 2013 at 19:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .