无法在Mac OSX上找到由pip安装的python模块的可执行文件

时间:2016-02-22 19:00:24

标签: python macos pip

我使用自制软件安装python并使用pip随附在Mac OS EL Captian上安装python软件包。

使用python安装的pip在安装python模块时工作正常,我在python shell中导入它没有问题(我已经测试了请求和beautifulsoup4,可以找到它们)。但是我找不到某些python模块的可执行文件。

例如,in this question I asked about python sphinx doc generator command not found。根据文档,我应该在pip install之后有一个可执行的sphinx-build命令。但正如您在该问题中所看到的,找不到该命令。

我进一步尝试了另一个,cookiecutter。 Pip安装运行顺利,没有任何问题。但仍未找到二进制可执行文件。如你所见:

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$ 

我还尝试使用pip install virtualenv仍面临未找到命令的问题。

我的Python版本是2.7.11,pip是8.0.2附带python。

1 个答案:

答案 0 :(得分:7)

使用pip show -f cookiecutter显示其安装的所有内容的位置(我从answer on how to list the files installed by pip

找到的位置

当我运行它时,它显示它已安装在../../../../usr/local/bin/cookiecutter中。查看其上方的Location信息(在我的情况下为/Library/Python/2.7/site-packages),我可以看到..字符串用于访问根目录。

在我的Mac上,它将其安装在/usr/local/bin中。所以我可以通过更新我的路径环境来访问它:

export PATH=$PATH:/usr/local/bin