0

I'm following the mkdocs setup process here: http://www.mkdocs.org/#installation

I'm not able to get mkdocs to do anything past the install on my local machine. I've installed the latest python and pip. I've verified the mkdocs package is installed, but still nothing:

$ 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

Are there additional steps needed to get mkdocs running on OSX?

4

1 回答 1

1

我遇到了同样的问题。

-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
  ...

剩下的,你应该可以操作了。祝你好运。

于 2019-03-24T07:36:16.057 回答