Python Forum

Full Version: ModuleNotFoundError: No module named '_struct' when starting pip3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My OS environment is openSUSE Tumbleweed.

I cloned the latest Python code from git.
git clone -b main --single-branch [email protected]:python/cpython.git
I compiled the code locally, and successfully done after solved all modules error.
./configure --prefix=/opt/python3 --enable-optimizations --with-ensurepip=install
make
sudo make install
And also linked pip and pip3 to new target compiled /opt/python3/bin/pip3.
alts -l pip
alts -l pip3
And also linked /usr/bin/python3 to new target /opt/python3/bin/python3.

Add below into profile for environment setting.
## Python
export PYTHONHOME=/opt/python3
export PYTHONPATH=/opt/python3/lib:/opt/python3/lib64:/opt/python3/lib/python3.11:/opt/python3/lib/python3.11/site-packages

## Update PATH
export PATH=$PYTHONHOME:$PYTHONPATH:$PATH
After above preparation, I got error ModuleNotFoundError: No module named '_struct' when I tried to launch pip, and got error ModuleNotFoundError: No module named 'readline' when I tried to launch python.

Please advise. Thanks.