如何在Amazon Elastic Beanstalk上安装opencv-python

时间:2014-11-04 00:45:50

标签: python opencv amazon-web-services amazon-ec2 elastic-beanstalk

我一直在本地开发Python应用程序,现在想将它部署到Amazon Elastic Beanstalk,但是我遇到了以下错误:

Downloading/unpacking opencv-python==2.4.8.1 (from -r
/opt/python/ondeck/app/requirements.txt (line 12))  
Could not find any downloads that satisfy the requirement opencv-python==2.4.8.1
(from -r /opt/python/ondeck/app/requirements.txt (line 12))

Some externally hosted files were ignored (use --allow-external opencv-python to allow). 
Cleaning up... No distributions at all found for opencv-python==2.4.8.1 
(from -r /opt/python/ondeck/app/requirements.txt (line 12))

如果我用SSH连接并输入sudo pip install opencv-python它会说“下载/解压缩opencv-python”一分钟左右,那么:

Could not find any downloads that satisfy the requirement opencv-python
Cleaning up...
No distributions at all found for opencv-python
Storing debug log for failure in /root/.pip/pip.log

我也尝试在我的requirements.txt中添加“http://rpmfind.net/linux/fedora/linux/development/rawhide/x86_64/os/Packages/o/opencv-python-2.4.9-3.fc22.x86_64.rpm”,但失败如下:

Downloading/unpacking http://rpmfind.net/linux/fedora/linux/development/rawhide/x86_64/os/Packages/o/opencv-python-2.4.9-3.fc22.x86_64.rpm (from -r /opt/python/ondeck/app/requirements.txt (line 14))
  Cannot unpack file /tmp/pip-ONBFer-unpack/opencv-python-2.4.9-3.fc22.x86_64.rpm (downloaded from /tmp/pip-SUUfnS-build, content-type: application/x-rpm); cannot detect archive format
Cleaning up...
Cannot determine archive format of /tmp/pip-SUUfnS-build
Storing debug log for failure in /root/.pip/pip.log

我也试过“sudo yum install opencv-python”,但失败如下:

Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/2014.09                                        | 2.1 kB     00:00
amzn-updates/2014.09                                     | 2.3 kB     00:00
No package opencv-python available.
Error: Nothing to do

对于我的开发系统,我从http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv获得了安装程序。我怎么能把它安装在EB上呢?

如果没有办法安装这个确切的包裹,请问最好的选择是什么?

3 个答案:

答案 0 :(得分:1)

如果您能够考虑解决方法,可以使用以下选项。

使用AWS Elastic Beanstalk

没有AWS Elastic Beanstalk

答案 1 :(得分:1)

目前简单的解决方法是安装pip 1.2.1,它不需要SSL:

curl -O https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz
tar xvfz pip-1.2.1.tar.gz
cd pip-1.2.1
python setup.py install

也许这可以帮到你

答案 2 :(得分:0)

我在Amazon EC2上运行OpenCV,在Ubuntu 14.04的专用实例上运行Python。我必须从源代码安装和编译才能获得可靠的python堆栈。