-bash: doc2dash: 在OS X Mavericks中找不到命令

0 投票
1 回答
796 浏览
提问于 2025-04-17 21:25

我有一台刚买两天的Mac Pro,系统是OS X Mavericks,现在想让doc2dash正常工作。

我已经安装了Python、pip和doc2dash,但在终端输入“doc2dash”时,总是出现以下错误。

-bash: doc2dash: command not found

这是我的.bash_profile文件的内容:

# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc


#[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

##
# Your previous /Users/USERNAME/.bash_profile file was backed up as /Users/USERNAME/.bash_profile.macports-saved_2014-03-08_at_02:37:54
##

# MacPorts Installer addition on 2014-03-08_at_02:37:54: adding an appropriate PATH variable for use with MacPorts.
#export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.

根据评论进行了编辑:

which doc2dash

结果什么都没有返回。

当我运行'sudo pip install --user doc2dash'时,出现了以下内容:

Requirement already satisfied (use --upgrade to upgrade): doc2dash in /Users/USERNAME/Library/Python/2.7/lib/python/site-packages
Cleaning up...

当我在上面的目录中列出doc2dash文件时,显示的是:

drwxr-xr-x   9 USERNAME  staff  306 Mar  8 02:28 doc2dash
drwxr-xr-x   9 USERNAME  staff  306 Mar  8 02:28 doc2dash-1.2.0.dist-info

doc2dash并不在/usr/local/bin这个文件夹里。

有人能告诉我该怎么做才能让这个命令正常工作吗?

1 个回答

3

pip install --user 这个命令会把一些工具安装到 ~/Library/Python/2.7/bin 这个地方。为了让你的电脑知道这些工具在哪里,你需要更新一下你的 .bash_profile 文件,加入以下这一行:

export PATH="$HOME/Library/Python/2.7/bin:/usr/local/bin:$PATH"

然后,打开一个新的终端窗口,这样你的系统就能找到 doc2dash 这个工具了。

撰写回答