I installed python2.7 and pip following these instructions, on MacOS X Yosemite, version 10.10.3.
I can successfully install packages and import them inside my python environment and python scripts. However, any executable associated with a package that can be called from the command line in the terminal are not found.
For example, I tried to install a package called "rosdep" as instructed here. I can run sudo pip install -U rosdep
which installs without errors and the corresponding files are located in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
. However, sudo rosdep init
subsequently reports that the rosdep
command is not found.
I even tried adding the above site-packages
path to my $PATH
, but the executables are still not found on the command line, even though the packages work perfectly from within python.
Why does this happen, and how can I fix it?
See also: Unable to import a module that is definitely installed - these two problems often have the same root cause.
check your $PATH
tox
has a command line mode:
audrey:tests jluc$ pip list | grep tox
tox (2.3.1)
where is it?
(edit: the 2.7
stuff doesn't matter much here, sub in any 3.x
and pip's behaving pretty much the same way)
audrey:tests jluc$ which tox
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/tox
and what's in my $PATH?
audrey:tests jluc$ echo $PATH
/opt/chefdk/bin:/opt/chefdk/embedded/bin:/opt/local/bin:..../opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin...
Notice the /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin? That's what allows finding my pip-installed stuff
Now, to see where things are from Python, try doing this (substitute rosdep
for tox
).
$python
>>> import tox
>>> tox.__file__
that prints out:
'/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tox/__init__.pyc'
Now, cd to the directory right above lib
in the above. Do you see a bin directory? Do you see rosdep
in that bin? If so try adding the bin
to your $PATH.
audrey:2.7 jluc$ cd /opt/local/Library/Frameworks/Python.framework/Versions/2.7
audrey:2.7 jluc$ ls -1
output:
Headers
Python
Resources
bin
include
lib
man
share