Can't call Python entry_points from command line

216 views Asked by At

I just installed a python tool for line profiling that should ship with itself a command line entry point named kernprof

$pip install line_profiler

a quick search returns:

$find /opt/local/Library/Frameworks/Python.framework/ -name 'kernprof.py'
opt/local/Library/Frameworks/Python.framework//Versions/2.7/lib/python2.7/site-packages/kernprof.py

and the module is callable from the Python's interactive console, but

$which kernprof 

does not return anything.

I suppose that this behaviour could be related to the fact that I'm using python-2.7 from Macports on OSX OS with wrong or incomplete path settings.

1

There are 1 answers

0
rdbisme On BEST ANSWER

The problem is that with Macports's Python the scripts are installed in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/ that is not in the PATH.

The lighter solution could be to symlink the script to /usr/local/bin

sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/kernprof /usr/local/bin