calling pydoc file
is returning, bad interpreter. no such file or directory.
There's a workaround by calling it like python -m pydoc file
.
I would love to understand the way the links work better. For example what does the following do?
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc /usr/bin/pydoc
- which one is linking to which?
I'm running version 2.7 and pydoc exists in the /usr/bin/, as do pydoc2.5 and pydoc2.6. Same issue with python-config, which also exists in 2.5 and 2.6 versions.
Thanks a lot for any insight.
Here's how problem was solved, based on correct answer below:
re-downloaded the python framework from http://andilabs.com/Python.framework.zip after finding it via Python asks for older paths on mac after deleting duplicate python installation
made a backup copy of pydoc2.7
by running sudo mv pydoc2.7 pydoc 2.7-orig
pydoc2.7
to the framework version 2.7 bin using sudo cp /Users/mikekilmer/Downloads/Python.framework/Versions/2.7/bin/pydoc2.7 /System/Library/Frameworks/Python.framework/Versions/2.7/bin/
. Apparently whatever i had under pydoc2.7 was not the right thing. Thanks a lot for explaining how links work!
The command:
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc /usr/bin/pydoc
Creates a link called /usr/bin/pydoc
that points to:
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc
On my system, this file doesn't exist. Instead, I have:
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2.7
Notice the 2.7
at the end.
So you've created a link to a file that doesn't exist and you get a complaint on your command line. The fix is simple, delete /usr/bin/pydoc
(first make sure it is a link by typing ls -l /usr/bin
and look for pydoc
-- if it has an l
next to its permissions, then it's a link). Then, type:
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2.7 /usr/bin/pydoc
This will create a link to the correct file and you should be able to run pydoc
as a script now.