Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/133.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 尝试将Flask应用程序部署到AWS Elastic Beanstalk时出错_Python_Amazon Web Services_Flask_Pip - Fatal编程技术网

Python 尝试将Flask应用程序部署到AWS Elastic Beanstalk时出错

Python 尝试将Flask应用程序部署到AWS Elastic Beanstalk时出错,python,amazon-web-services,flask,pip,Python,Amazon Web Services,Flask,Pip,我正在尝试使用AWS Elastic Beanstalk部署Flask应用程序,不幸的是遇到了以下错误。让我困惑的是,在我的虚拟环境和本地机器中,pip的当前版本是9.0.1,所以我不知道为什么它会选择7.1.2 Command "/opt/python/run/venv/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-L32BGc/cffi/setup.py';exec(compile(getattr

我正在尝试使用AWS Elastic Beanstalk部署Flask应用程序,不幸的是遇到了以下错误。让我困惑的是,在我的虚拟环境和本地机器中,pip的当前版本是9.0.1,所以我不知道为什么它会选择7.1.2

Command "/opt/python/run/venv/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-L32BGc/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-nO55i_-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-build-L32BGc/cffi
  You are using pip version 7.1.2, however version 9.0.1 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
  2017-01-29 15:42:34,743 ERROR    Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
  Traceback (most recent call last):
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
      install_dependencies()
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
      check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
    File "/usr/lib64/python2.7/subprocess.py", line 541, in check_call
      raise CalledProcessError(retcode, cmd)
  CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 (Executor::NonZeroExitStatus)

这是因为pip版本太旧了。您可以添加.ebextensions来解决此问题

在应用程序的根文件夹中添加.ebextensions文件夹 将一个pip.config文件放入其中,内容如下: 再次运行eb部署,它将得到解决。

commands:
  update_pip:
  command: "/opt/python/run/venv/bin/pip install --upgrade pip"