在OSX上找不到mkdocs命令

问题描述 投票:0回答:1

我在这里关注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上运行mkdocs?

python macos shell pip mkdocs
1个回答
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
  ...

其余的,你应该能够操作。祝好运。

© www.soinside.com 2019 - 2024. All rights reserved.