简体   繁体   中英

AWS - install python packages while deploying EC2 server

i am currently working on a project where I need to deploy python application on my EC2 instance. I cannot seem to figure out how to install packages on my EC2 instance during application installation. I have tried installation via "requirements.txt" file

mysql-connector-python==8.0.22

as well as via.ebextenstion/01_packages.config file that looks as following:

packages:
    yum:
        mysql-connector-python: '8.0.22'
        requests: '2.24.0'

BUT every time is deploy new version of my application i get an error and updated list of packages is not installed.

Any assistance is highly appreciated.

I verified on EB Python 3.7 AL2 version 3.1.4 that the following requirements.txt works:

mysql-connector-python==8.0.22
requests==2.24.0

Thus if you have other issues, they are not caused by the requirements.txt on that platform.

Ended up creating setup.config file in my.ebextentions, where I configured command to install required packages.

commands:
    install_requests:
        command: "pip install requests"
    install_wheel:
        command: "pip install wheel"
    install_mysql-connector-python:
        command: "pip install mysql-connector-python"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM