I want to set up a python virtual environment with a version of python that I have installed from source, independent of the repositories. The reason for this is that I am running tumbleweed on one pc, Leap 15.0 on another, and will plan to upgrade to Leap 15.2 on another when it is available. Tumbleweed gets the latest version of python that is available, and this last time it replaced all my 3.6 binaries with 3.7 binaries, so I want to avoid that in the future. I am working on a long term project, and I need to maintain a python environment that is independent of repository updates. So I figured I would do that with a virtual environment that is based on something I have installed from source. I am open to other ideas also. I tried installing python 3.7.2 in my Leap 15 laptop based on the guide at this URL: https://realpython.com/installing-python/#compiling-python-from-source That put the new python 3.7.2 into the directory /usr/local/bin instead of /usr/bin. Also, somehow it doesn't seem to pull in everything necessary. When I try to set up the virtual environment with the command virtualenv -p /usr/local/bin/python3.7 .smdellvenv it comes up with the error :
virtualenv -p /usr/local/bin/python3.7 .smdellvenv Running virtualenv with interpreter /usr/local/bin/python3.7 Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/virtualenv.py", line 16, in <module> import base64 File "/usr/local/lib/python3.7/base64.py", line 10, in <module> import struct File "/usr/local/lib/python3.7/struct.py", line 13, in <module> from _struct import * ModuleNotFoundError: No module named '_struct'
So I tried to change the PYTHONHOME variable like this:
export PYTHONHOME="/usr/local/bin/python3.7"
Now, when I run the virtualenv command, this is what happens:
virtualenv -p /usr/local/bin/python3.7 .smdellvenv Fatal Python error: Py_Initialize: Unable to get the locale encoding ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f06c17f2540 (most recent call first): Aborted (core dumped) Anyone have any success with installing python from source? Do I need to build my own full set of packages, or perhaps download what is available on the build service? Any help would be greatly appreciated. Thanks, George -- George Box: TW | Plasma 5 | AMD Phenom IIX4 | 64 | 32GB Laptop #1: TW | Plasma 5 | AMD FX 7TH GEN | 64 | 32GB Laptop #2: 15.0 | Plasma 5 | Core i5 | 64 | 8GB -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org