I am running into the problem with Python3. When I run it, I get the following error:
$ python3Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>:<exec_prefix>]
Python 3.8.5 (default, Aug 6 2020, 12:00:00)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "/etc/pythonstart", line 7, in <module>
import readline
ModuleNotFoundError: No module named 'readline'
I tried all kinds of things that I could find, but nothing seems to help. This also breaks many other applications which rely on python3 (e.g., Dropbox).
These are the contents of my /use/lib/python:
ls /usr/lib/python
python2.7/ python3.6/ python3.8
Please, kindly, help! It is seriously is killing my work.
The Python that’s included in default openSUSE installs is mainly to ease running python apps.
If you wish to become a serious Python developer,
It’s essential you learn how to set up Python virtual environments… The current “more official” tool is venv, but there’s maybe 4 often used utilities that do this with different features.
When you develop in python virtual environments (not to be confused with virtualization), you have the ability to specify and confine different python versions for each python app’s directory tree, ensuring that the right python modules and path are used for that app. You should realize this means you can also deploy python versions side by side on your machine which can be important if you develop your app for distribution because different distros and systems will be running on different versions of python.
Beyond that, the error that’s thrown should be self-explanatory…
Your code is looking for the python module that provides “readline” and can’t find it. You’ll either need to correct the environment to find the library or install it if necessary.
Lastly,
Here’s a hint
You didn’t say how/where you installed your various Python, but even if you’re using python from openSUSE and not PyPi, developers have a need for more packages than ordinary Users so should intall the special openSUSE python repositories. Do you know how to find them? If you need help, post again.
Thank you! I actually did develop python programs and have an idea of the language. However, I am new to the venv thing.
I tried running Dropbox and got that error. Later I found that python3 is not running at all because of the above. I did not do anything that I can think of as it worked before.
Running any app should not affect (much less damage) any installed python. At most, it might have made some unauthorized or improper change to your system environment, but that would be improper and not to be expected.
If you made a change to your system recently including installing apps that place files in the root partition and are installed on BTRFS, you can undo the changes easily by rolling back to a date before the change (and you can undo your rollback too if you wish). Just use Snapper (I’m pretty sure for this operation the command line is better but can also be done using the YaST snapper module).
More likely your error is caused by something else…
Repos enabled but no refresh, CentOS Repos and too many Repos.
Packman and multimedia:libs together is no good choice, I prefer only Packman.
Do you need them all?
I would say, you should delete many Repos but before that, look what is installed from that Repo and switch the packages to the “normal” one.