sunmingtao / sample-code

3 stars 4 forks source link

Error: PythonPipBuilder:Validation - Binary validation failed for python, searched for python in following locations : ['/usr/local/bin/python', '/usr/bin/python'] which did not satisfy constraints for runtime: python3.7. #142

Closed sunmingtao closed 4 years ago

sunmingtao commented 4 years ago

Follow the aws sam tutorial https://www.udemy.com/course/aws-certified-developer-associate-dva-c01/learn/lecture/19731762#questions Run command sam build and get error

mingtao-sam-app\ =>sam build
Building function 'HelloWorldFunction'

Build Failed
Error: PythonPipBuilder:Validation - Binary validation failed for python, searched for python in following locations  : ['/usr/local/bin/python', '/usr/bin/python'] which did not satisfy constraints for runtime: python3.7. Do you have python for runtime: python3.7 on your PATH?

Python version is 2.7

mingtao-sam-app\ =>python -V
Python 2.7.15
sunmingtao commented 4 years ago

Create a virtual Python environment.

mingtao-sam-app\ => python3 -m venv ~/.venv
mingtao-sam-app\ => source ~/.venv/bin/activate
(.venv) mingtao-sam-app\ =>python --version
Python 3.7.3