1

我正在尝试在弹性 beanstalk 实例上安装 peewee 包来控制瓶子应用程序。我认为问题出在 MySQL-python 依赖项上,但 peewee 也没有加载。我的需求文件如下所示:

bottle==0.11.6
peewee==2.1.1
MySQL-python

我也试过MySQL-pythonMySQL-python==1.2.4b4由于我认为这里总结了许多原因,这是行不通的;peewee 未安装,我在日志中收到此错误消息:

2013-05-18 06:57:08,407 [INFO] (15947 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Script succeeded.
2013-05-18 06:57:08,408 [INFO] (15947 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Executing script: /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py
2013-05-18 06:57:18,663 [INFO] (15947 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Output from script: New python executable in /opt/python/run/venv/bin/python2.6
Not overwriting existing python script /opt/python/run/venv/bin/python (you must use /opt/python/run/venv/bin/python2.6)
Installing distribute..................................................................................................................................................................................................done.
Installing pip................done.
Requirement already satisfied (use --upgrade to upgrade): bottle==0.11.6 in /opt/python/run/venv/lib/python2.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 1))
Downloading/unpacking peewee==2.1.1 (from -r /opt/python/ondeck/app/requirements.txt (line 2))
  Running setup.py egg_info for package peewee
Downloading/unpacking MySQL-python (from -r /opt/python/ondeck/app/requirements.txt (line 3))
  Running setup.py egg_info for package MySQL-python
    The required version of distribute (>=0.6.28) is not available,
    and can't be installed while this script is running. Please
    install a more recent version first, using
    'easy_install -U distribute'.

    (Currently using distribute 0.6.27 (/opt/python/run/venv/lib/python2.6/site-packages/distribute-0.6.27-py2.6.egg))
    Complete output from command python setup.py egg_info:
    The required version of distribute (>=0.6.28) is not available,

and can't be installed while this script is running. Please

install a more recent version first, using

'easy_install -U distribute'.

所以 pip 不适用于这些包。我很确定我可以通过连接到 EC2 实例并在没有 pip 的情况下安装 MySQL-python 来解决这个问题,但在我看来,这会破坏弹性 beanstalk 的目的,因为每次启动新实例时都需要我去并手动修改它。我有没有合适的方法来处理这个问题?我在尝试安装 scipy 和 matplotlib 之类的东西时也遇到了同样的问题,那么广泛地说,有没有一种方法可以在没有 pip 的情况下在弹性 beanstalk 实例上安装 python 包,并且无需单独进入每个实例?我是否应该研究如何制作自定义 AMI 并在 beanstalk 上使用它?非常感谢,亚历克斯

4

1 回答 1

0

对不起,我忘了我问了这个。我最终通过 ssh 进入实例并使用 easy_install 而不是 pip 安装 MySQL-Python 解决了这个问题。

基本上我去了python虚拟环境方向:

opt/python/run/venv/bin

并使用 easy_install 安装了 1.2.3 版:

sudo ./easy_install MySQL-Python==1.2.3

我通过尝试在虚拟环境的 python 中导入 MySQLdb 来检查它是否已安装:

./python

>>>import MySQLdb
>>>

它对我有用。然后我通过使用弹性 beanstalk 命令行工具再次推送服务器来重置服务器:

git aws.push

就是这样。不得不这样做有点烦人,但它似乎在启动新实例时继续工作。

谢谢,亚历克斯

于 2013-05-25T00:21:51.050 回答