PyQGIS QgsVectorLayer() Loading Invalid Layer in Standalone Python Script?

Per the solution found at this link: https://github.com/OSGeo/homebrew-osgeo4mac/issues/197

The QgsApplication.setPrefixPath() is not correctly setting the prefix. Therefore, the vector layer cannot load properly.

A workaround is to set the QGIS prefix environment variable directly using the os module in Python:

os.environ['QGIS_PREFIX_PATH'] = r'prefix\path'

Once the prefix path is correctly set, the vector layer should load properly and .isValid() should yield 'True'