Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find executable of python module installed by pip on Mac OSX

Tags:

python

macos

pip

I install python using homebrew and use pip comes with it to install python package on Mac OS EL Captian.

The pip installed with python works fine when install python modules and I have no problem import it in python shell(I have test the requests and beautifulsoup4 and they can be found). But I cannot find the executable for some python modules.

For example, in this question I asked about python sphinx doc generator command not found. Based on the documentation I should have a executable sphinx-build command available after pip install. But as you can see in that question, the command is not found.

I further tried another one, cookiecutter. Pip install runs smoothly without any issues. But the binary executable is still not found. As you can see:

JINXUANs-MacBook-Pro:~ jinxuanwu$ pip install cookiecutter
Requirement already satisfied (use --upgrade to upgrade): cookiecutter in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): binaryornot>=0.2.0 in /usr/local/lib/python2.7/site-packages (from cookiecutter)
Requirement already satisfied (use --upgrade to upgrade): whichcraft>=0.1.1 in /usr/local/lib/python2.7/site-packages (from cookiecutter)
Requirement already satisfied (use --upgrade to upgrade): future>=0.15.2 in /Library/Python/2.7/site-packages (from cookiecutter)
Requirement already satisfied (use --upgrade to upgrade): ruamel.yaml>=0.10.12 in /usr/local/lib/python2.7/site-packages (from cookiecutter)
Requirement already satisfied (use --upgrade to upgrade): jinja2>=2.7 in /Library/Python/2.7/site-packages (from cookiecutter)
Requirement already satisfied (use --upgrade to upgrade): click>=5.0 in /usr/local/lib/python2.7/site-packages (from cookiecutter)
Requirement already satisfied (use --upgrade to upgrade): chardet>=2.0.0 in /usr/local/lib/python2.7/site-packages (from binaryornot>=0.2.0->cookiecutter)
Requirement already satisfied (use --upgrade to upgrade): ruamel.ordereddict in /usr/local/lib/python2.7/site-packages (from ruamel.yaml>=0.10.12->cookiecutter)
Requirement already satisfied (use --upgrade to upgrade): ruamel.base>=1.0.0 in /usr/local/lib/python2.7/site-packages (from ruamel.yaml>=0.10.12->cookiecutter)
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe in /Library/Python/2.7/site-packages (from jinja2>=2.7->cookiecutter)
JINXUANs-MacBook-Pro:~ jinxuanwu$ cookiecutter
-bash: cookiecutter: command not found
JINXUANs-MacBook-Pro:~ jinxuanwu$ 

I also tried use pip install virtualenv still facing the command not found problem.

My Python version is 2.7.11, pip is 8.0.2 comes with python.

like image 784
xuanyue Avatar asked Feb 08 '23 16:02

xuanyue


1 Answers

Use pip show -f cookiecutter to show the location of everything it installed (which I found from this answer on how to list the files installed by pip

When I ran this, it shows that it's installed in ../../../../usr/local/bin/cookiecutter. Looking at the Location information above it (/Library/Python/2.7/site-packages in my case), I can see that the string of .. are used to get to the root directory.

On my Mac, it installed it in /usr/local/bin. So I can access it by updating my path environmental:

export PATH=$PATH:/usr/local/bin
like image 150
unpythonic Avatar answered Feb 13 '23 04:02

unpythonic