Python 3.6 오류가 있는 AWS EB 및 Python 2.7 사용

Python 3.6 오류가 있는 AWS EB 및 Python 2.7 사용

인스턴스에 이미 설치된 Python 3 버전을 사용하도록 aWS EB 인스턴스를 얻으려면 어떻게 해야 합니까? Django 2.1+를 실행하는 Python 3.6으로 실행되는 새 환경을 얻을 수 없습니다.

로컬(가상 환경이 아님):

which python -> /usr/local/bin/python
python -V -> Python 2.7.15
which python3 -> /usr/local/bin/python3
python3 -V -> Python 3.6.5
which pip -> /usr/local/bin/pip
pip -V -> pip 18.0 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)`
which pip3 -> /usr/local/bin/pip3
pip3 -V -> pip 18.0 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)

virtualenv의 로컬mstFirst:

which python -> /Users/me/.virtualenvs/mstFirst/bin/python
which python3 -> /Users/me/.virtualenvs/mstFirst/bin/python
python -V -> Python 3.6.5
python3 -V -> Python 3.6.5
which pip -> /Users/me/.virtualenvs/mstFirst/bin/pip
which pip3 -> /Users/me/.virtualenvs/mstFirst/bin/pip3
pip -V -> pip 18.0 from /Users/me/.virtualenvs/mstFirst/lib/python3.6/site-packages/pip (python 3.6)
pip3 -V -> pip 18.0 from /Users/me/.virtualenvs/mstFirst/lib/python3.6/site-packages/pip (python 3.6)
aws --version -> aws-cli/1.16.9 Python/3.6.5 Darwin/17.7.0 botocore/1.11.9
eb --version -> EB CLI 3.14.4 (Python 3.6.5)
eb -list -> * mst-p3
eb -config ->
  ApplicationName: mst
  DateUpdated: 2018-09-07 02:15:51+00:00
  EnvironmentName: mst-p3
  PlatformArn: arn:aws:elasticbeanstalk:us-east-1::platform/Python 3.6 running on 64bit Amazon Linux/2.7.3
  settings: …

파일:

".elasticbeanstalk/config.yml"

branch-defaults:
  master:
    environment: mst-p3
environment-defaults:
  mst-p3: …
global:
  application_name: mst
  default_platform: 64bit Amazon Linux 2018.03 v2.7.3 running Python 3.6
  default_region: us-east-1
  workspace_type: Application

".ebextensions/01_packages.config"

packages:
  yum:
    git: []
    python36: []
    python36-devel: []
    postgresql93: []
    postgresql93-devel: []
    mod24_ssl : []

commands:
  pip_upgrade:
    command: /opt/python/run/venv/bin/pip install --upgrade pip
    ignoreErrors: false

eb deploy실행을 시도하는 동안 잘못된 Python 버전(2.7)을 가리키는 오류가 발생했습니다 pip install -r requirements.py.

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-jt3_s4in/slugger/
2018-09-07 03:28:35,315 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 186, 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)

원격 인스턴스 SSH( eb ssh):

pyhthon -V -> Python 2.7.14
pyhthon3 -V -> Python 3.6.5

내가 시도한 것들:

  • 환경 AMI를 현재 버전으로 교체하고 그에 따라 재구축https://stackoverflow.com/a/47157777/1234721, 그러나 "Amazon Linux AMI 2018.03.0(HVM), SSD 볼륨 유형"에 대한 "ami-0ff8a91507f77f867" AMI의 환경 오류
  • Python 버전을 전환하기 위해 YAML 구성에 연결하려고 합니다.
  • 다음을 사용하여 다시 초기화eb init

관련 정보