wxpython using pyenv virtual environment

I’m posting here because the pyenv issue I’m having appears to be an issue with OpenSuSE only.

I posted a few years back about getting wxGlade to work. I’m getting back to my project that uses wxGlade for the GUI development. Everything is working on the system python v3.6.12.

I thought it would be nice to be able to develop the GUI in a different python version if I’m targeting the python application at a different python version. While I have pyenv and pyenv virtualenv working for different versions of python there is a problem specific to wxpython. The problem is that when using pip install or pip wheel to create the whl file for wxpython it fails.

I don’t understand what’s going on. Someone said that the wx.pth file should link to the system installed wx. Since I’m trying to use a wxpython compiled for something other than python v3.6.12 (i.e. I’m trying to compile for v3.8.6) I don’t believe this will work.

I read somewhere else that while compiling wxpython in the virtual environment the compiler is still trying to use the wx from the system python. The way I believe that’s happening is that pip is creating tmp directories but the PATH variable isn’t updated with the tmp directory during the process. Therefore, the process is defaulting back to /usr/lib64/wx. The tmp directories have different names each time pip wheel is run. I tried changing LD_LIBRARY_PATH in the pyenv environment to see if that would help. It didn’t but I don’t know if I set the path correctly. I suspect it would need to be the tmp directory.

Does any of that sound familiar?

Is there a way to use pyenv, install a virtual environment that uses python v3.8.6 and successfully compile wxpython for that python version and make the wx library available within the virtual environment?