无法运行树懒注释工具

时间:2015-10-19 10:49:20

标签: python annotations install 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'

4 个答案:

答案 0 :(得分:2)

Sloth是一个可执行的Python脚本。因此,要运行它,您可以从终端调用它:

PATH_PREFIX_TO_YOUR_PYTHON/Python27/Lib/site-packages/sloth/bin/sloth

您可以add sloth script directory to your PATH编辑yout .bashrc文件:

export PATH=$PATH:PUT_PATH_TO_SLOTH_HERE

然后运行source .bashrc以使更改生效。之后,在终端窗口中键入sloth应打开GUI。

在Windows中,我设法使用Git Bash运行它(Windows的Git安装默认提供Bash模拟器)。在Git Bash终端窗口中,使用以下内容(如果您的Python安装目录不同,则可能需要进行更改):

/c/Python27/Lib/site-packages/sloth/bin/sloth

答案 1 :(得分:2)

以下适用于Windows,使用Anaconda python 3.5版本(并安装所有依赖项):

recoverWithRetries

答案 2 :(得分:0)

在Windows下完成安装“懒惰”:

  1. conda create -n slo_py35 python=3.5

  2. activate slo_py35 git config --global http.proxy http://proxy.xxx.de:port #only if proxy available pip install git+https://github.com/cvhciKIT/sloth.git

  3. conda install -c anaconda pyqt=4.11.4 conda install scikit-image #or if it does not work, take: pip install scikit-image

  4. conda env list #shows the path to the installation for example: D:\...\anaconda3\envs\slo_py35\

  5. 运行懒惰: D:\...\anaconda3\envs\slo_py35\sloth\bin> python sloth

  6. 使用包含的示例运行懒惰: D:\...\anaconda3\envs\slo_py35\sloth\bin> python sloth D:\xxx\examples\example1_labels.json

可能的问题: FileNotFoundError: No such file or directory: 'D:\...\anaconda3\envs\slo_py35\lib\site-packages\sloth\gui\labeltool.ui'

解决方案:ui文件存在并且放置在错误的位置 D:\...\anaconda3\envs\slo_py35\sloth\gui\labeltool.ui ui文件仅需要复制到正确的路径,请参见错误消息,然后运行。

答案 3 :(得分:-1)

对于我在Windows中,它按以下方式工作

 if(n!=null){
     treeTraversal(n.left);
     System.out.println(n.val);
     treeTraversal(n.right);
 }