【问题标题】:python-virtualenv : Can't run bash script properlypython-virtualenv:无法正确运行 bash 脚本
【发布时间】:2016-03-03 10:52:08
【问题描述】:

我已经下载了OCROpus Reader,并使用 -:

将它安装在我的 Ubuntu 机器的 virtualenv 中
$ virtualenv ocropus_venv/
$ source ocropus_venv/bin/activate
$ pip install -r requirements_1.txt
# tables has some dependencies which must be installed first:
$ pip install -r requirements_2.txt
$ wget -nd http://www.tmbdev.net/en-default.pyrnn.gz
$ mv en-default.pyrnn.gz models/

现在当我遵循命令时-:

$ ./run-test

我得到了错误-:

./run-test: line 4: ocropus-nlbin: command not found

这是因为我在虚拟环境中安装了 OCROpus 造成的问题吗? shell 脚本是否找不到安装包的路径?

需要帮助。

run-test.sh的内容是-:

#!/bin/bash -e

rm -rf temp 
ocropus-nlbin tests/testpage.png -o temp
ocropus-gpageseg 'temp/????.bin.png'
ocropus-rpred -n 'temp/????/??????.bin.png'
ocropus-hocr 'temp/????.bin.png' -o temp.html
ocropus-visualize-results temp
ocropus-gtedit html temp/????/??????.bin.png -o temp-correction.html

echo "to see recognition results, type: firefox temp.html"
echo "to see correction page, type: firefox temp-correction.html"
echo "to see details on the recognition process, type: firefox temp/index.html"

【问题讨论】:

  • 可以显示run-test的内容吗?
  • @AvihooMamka 添加了run-test.sh的内容
  • 如果您在 virtualenv 下使用pip 安装了OCROpus,则需要以下两者之一: 1. 在脚本中导出 PATH 以指向所需的可执行文件。 2. 给出可执行文件的完整路径。例如:/path/to/virtualenv/bin/ocropus-nlbin ...
  • 您是否在虚拟环境中运行python setup.py install。在虚拟环境中运行时,文档错过了该步骤。
  • @JaseRieger 成功了。谢谢。将您的评论变成答案,以便我接受。

标签: python bash virtualenv


【解决方案1】:

您需要在虚拟环境中运行python setup.py install

文档在虚拟环境中运行时忽略了该步骤。

【讨论】:

  • 感谢您的提示。我现在相应地更新了 ocropy 中的文档(PR #196)。
猜你喜欢
  • 2018-08-15
  • 1970-01-01
  • 1970-01-01
  • 2021-07-15
  • 1970-01-01
  • 2020-07-19
  • 1970-01-01
  • 1970-01-01
  • 2011-08-10
相关资源
最近更新 更多