首页 > 编程问答 >无法运行树懒注释工具

无法运行树懒注释工具

时间:2024-07-23 12:41:01浏览次数:10  
标签:python installation setuptools

我正在尝试使用注释工具 Sloth 我如何让程序运行?

JMAIR-3:sloth user$ which python
/usr/local/bin/python
JMAIR-3:sloth user$ python --version
Python 2.7.10
JMAIR-3:sloth user$ brew install PyQt
Warning: pyqt-4.11.4 already installed
JMAIR-3:sloth user$ ls
COPYING     LICENSE     README.md   build       doc     examples    scripts     setup.py    sloth       tests
JMAIR-3:sloth user$ sloth
-bash: sloth: command not found
JMAIR-3:sloth user$ sudo python setup.py install 
Password:
running install
running build
running build_py
running build_scripts
running install_lib
running install_scripts
changing mode of /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/bin/sloth to 755
running install_data
running install_egg_info
Removing /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sloth-1.0-py2.7.egg-info
Writing /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sloth-1.0-py2.7.egg-info
JMAIR-3:sloth user$ sloth
-bash: sloth: command not found
JMAIR-3:sloth user$ sloth examples/example1_labels.json
-bash: sloth: command not found


 python sloth
/usr/local/opt/python/bin/python2.7: can't find 'main' module in 'sloth'

安装了 Sloth,但系统找不到该可执行文件。这可能是因为的 PATH 环境变量没有包含 Sloth 安装目录。

可以尝试以下两种解决方案:

1. 使用 sloth 的完整路径运行:

可以在 python setup.py install 命令的输出中找到 sloth 可执行文件的完整路径。它通常位于 /usr/local/bin/sloth /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/bin/sloth 等类似的路径下。

使用以下命令运行 Sloth,将 /path/to/sloth 替换为实际路径:

bash /path/to/sloth examples/example1_labels.json

2. 将 sloth 安装目录添加到 PATH 环境变量:

将以下行添加到的 .bashrc .zshrc 文件中(如果使用的是 Zsh),将 /path/to/sloth 替换为实际路径:

bash export PATH=$PATH:/path/to/sloth

然后,运行以下命令使更改生效:

bash source ~/.bashrc

bash source ~/.zshrc

现在,应该能够直接使用 sloth 命令运行 Sloth 了:

bash sloth examples/example1_labels.json

请注意,可能需要使用 sudo 权限来编辑 .bashrc .zshrc 文件。

如果仍然遇到问题,请提供以下信息,以便我进一步帮助:

  • 的操作系统
  • 使用的 Python 版本
  • python setup.py install 命令的完整输出
  • echo $PATH 命令的输出

标签:python,installation,setuptools
From: 33212494

相关文章

  • 我安装了哪个版本的 Python?
    我必须在Windows服务器上运行Python脚本。我如何知道我拥有哪个版本的Python,这真的很重要吗?我正在考虑更新到最新版本的Python。确定在Windows服务器上安装的Python版本至关重要,因为它可以确定脚本的兼容性和可用库。以下是检查方法:使用命令提......
  • @classmethod 在 Python 的类之外做什么?
    在下面的代码中,如果存在@classmethod注释,则允许内部defnew()代替目标的__new__()--但该类会传递两次。如果@classmethod被删除,那么我们会收到类似“”的错误。@classmethod这里在做什么,有没有办法不用它?(我的动机是清晰的:我不理......
  • 三种语言实现快速选择(C++/Python/Java)
    题目给定一个长度为......
  • 如何让SublimeText支持Python 3的注释?
    我测试了SublimeText2和3,两者都有错误:如果您测试此代码,您会注意到:之后的所有代码都不会正确突出显示语法。deffoo(a,b)->str:#Nothinggetsproperlycoloredfromhere#Abunchofcode…return"bar"我发现了一些链接,解释了如何......
  • 如何用可变长度注释Python列表
    如何为可变长度或None的Python列表编写注释?当我这样写时,它会返回一个错误。defsome_function(params:list[str,...])#thisgiveserror:`TypeError:'type'objectisnotsubscriptable`defsome_function(params:List[str,...])#thisalsogiveserro......
  • Python 协议和 Django 模型
    假设我有一个简单的协议A和一个未能实现该协议的类B:fromtypingimportProtocolclassA(Protocol):deffoo(self)->str:...classB:pass当下面的代码进行类型检查时,Mypy将正确地抱怨x:A=B()mypy.error:Incompatibletypes......
  • Python字段的字符串注释
    Python是否支持类字段的任何类型的字符串注释?例如,在Golang中,我可以定义这样的结构,带有可选的字符串标签:typeUserstruct{Namestring`example:"name"`}我需要在Python中定义一个新类,其中包含包含点.的字段名称。我希望可能有某种方法来注释字段,或者......
  • 具有未定义变量和注释的有效 Python 行
    我来了一篇文章,其中包含未定义的变量名称和某些类型注释。该行有效。它有什么作用以及可能的用途是什么?withundefinedvariablenamewithsometypeannotation.Thelineisvalid.Whatitdoesandwhatarepossibleusages?>>>x:int>>>xTraceback(mostr......
  • 使用 Python 通过逻辑应用运行长时间运行的 Azure Functions
    我已经尝试解决这个问题有一段时间了,但我似乎找不到解决方案。因此,正如标题所示,我试图通过函数在逻辑应用程序中运行长时间运行的操作。我有一个python代码,可以比较2个excel文件并进行一些转换。它工作正常,但是,Excel文件包含近20k行(它是动态的,将来会添加更多行),因此......
  • 使用递归函数计算阶乘时,我在 python 中遇到类型错误
    defcalc_fact(n):如果(n==1或n==0):返回1别的:n*calc_fact(n-1)print(calc_fact(5))试图创建函数来计算阶乘,不支持类型错误操作数*:对于int或Nonetype我不知道为什么谢谢Python代码中出现“类型错误:不支持的操作数类型为*:'int'和'NoneType'”表明你......