在OSX上找不到mkdocs命令

时间:2016-02-09 23:50:53

标签: python macos shell pip mkdocs

我在这里关注mkdocs设置流程:http://www.mkdocs.org/#installation

我无法让mkdocs在我的本地机器上安装任何东西。我安装了最新的python和pip。我已经验证了mkdocs软件包已安装,但仍然没有:

$ mkdocs --version
-bash: mkdocs: command not found

$ python --version
Python 2.7.10
$ pip --version
pip 8.0.2 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7)

$ which python
/usr/local/bin/python

$ pip install mkdocs --upgrade
Requirement already up-to-date: mkdocs in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requirement already up-to-date: Markdown>=2.3.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from mkdocs)
Requirement already up-to-date: livereload>=2.3.2 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from mkdocs)
Requirement already up-to-date: PyYAML>=3.10 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from mkdocs)
Requirement already up-to-date: tornado>=4.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from mkdocs)
Requirement already up-to-date: Jinja2>=2.7.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from mkdocs)
Requirement already up-to-date: click>=3.3 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from mkdocs)
Requirement already up-to-date: mkdocs-bootswatch>=0.1.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from mkdocs)
Requirement already up-to-date: mkdocs-bootstrap>=0.1.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from mkdocs)
Requirement already up-to-date: six in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from livereload>=2.3.2->mkdocs)
Requirement already up-to-date: backports.ssl-match-hostname in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from tornado>=4.1->mkdocs)
Requirement already up-to-date: singledispatch in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from tornado>=4.1->mkdocs)
Requirement already up-to-date: certifi in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from tornado>=4.1->mkdocs)
Requirement already up-to-date: backports-abc>=0.4 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from tornado>=4.1->mkdocs)
Requirement already up-to-date: MarkupSafe in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from Jinja2>=2.7.1->mkdocs)
$ cd /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
$ mkdocs
-bash: mkdocs: command not found
$ cd ~/
$ mkdocs --version
-bash: mkdocs: command not found

是否需要执行其他步骤才能在OSX上运行mkdoc?

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。

-bash: mkdocs: command not found

设置环境变量后,即可使用。

sudo vim ~/.bash_profile

在文件中添加以下内容,并注意该路径已由您自己替换。

PATH="/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/:${PATH}"
export PATH

使环境变量生效。

source ~/.bash_profile

然后您可以对其进行测试。

linupypc:~ linupy$ mkdocs
Usage: mkdocs [OPTIONS] COMMAND [ARGS]...

MkDocs - Project documentation with Markdown.

Options:
  -V, --version  Show the version and exit.
  -q, --quiet    Silence warnings
  ...

其余的,您应该可以操作。祝你好运。