python-3.xpython-2.7pathsam

Sam Build Failing due to python version


I was running python version 2.7.18, i installed the python3 because that is runtime for the lambda to build with sam build. I keep getting this error:

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

I added to Path: enter image description here

did not work.

I tried everything on this question and answer: How to export PATH to "sam build" command?

enter image description here and

enter image description here

still getting Build failed.

when i run which python i still get: enter image description here

which i check the --version for both python and python3 i get:

enter image description hereNot sure what I am missing? thanks for any help.


Solution

  • I just uninstalled both versions of python, and re-installed python3. That was the long way but it worked.