Error running Psychopy from code on Mac on venv Python (needs framework python)

Solution to my problem.

Install python enabling framework and then do the rest of the installation as defined

PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.6.8

The issue was with wx and the need for a framework

When running a simple ws app

import wx

app = wx.App(False)  # Create a new app, don't redirect stdout/stderr to a window.
frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window.
frame.Show(True)     # Show the frame.
app.MainLoop()

I got this error

This program needs access to the screen. Please run with a Framework
build of python, and only when you are logged in on the main display
of your Mac.

That lead me to this wiki wxPythonVirtualenvOnMac - wxPyWiki and other stackoverflow pages indicating

If you are getting the error that "This program needs access to the screen. Please run with a Framework build of python, and only when you are logged in on the main display of your Mac." 

The reason is because some 3rd party tools like PyInstaller might require CPython installation be built with --enable-framework. 

What you need to do is run $ env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.x.x in your terminal.