T3Crypto
Posts: 2
Joined: Wed Jun 22, 2022 5:51 pm

Python Lib Prefixes

Wed Jun 22, 2022 5:58 pm

Hello all!

Deleted all the of the Python prefixes from my lib and .local lib!!!
/lib/pypy/
/lib/python2.7/
/lib/python3/
/lib/python3.9/
/home/myusername/.local/lib/python3.9/

Is it possible to reinstall this software? If not, what would you do in this situation?

Please advise, and thank you very much!!

T3Crypto
Posts: 2
Joined: Wed Jun 22, 2022 5:51 pm

Re: Python Lib Prefixes

Wed Jun 22, 2022 6:00 pm

First, I need to take a deep breath :)

memjr
Posts: 1187
Joined: Fri Aug 21, 2020 5:59 pm

Re: Python Lib Prefixes

Thu Jun 23, 2022 12:58 am

What you show is the installation of multiple versions of python. Is there anything actually wrong? Why do you need/want to reisntall?

DeaD_EyE
Posts: 66
Joined: Sat May 17, 2014 9:49 pm

Re: Python Lib Prefixes

Thu Jun 23, 2022 10:14 am

This should install the supported Python 3 Version on Debian.

Code: Select all

sudo apt-get update
sudo apt-get install python3

DirkS
Posts: 10748
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Python Lib Prefixes

Thu Jun 23, 2022 12:31 pm

DeaD_EyE wrote:
Thu Jun 23, 2022 10:14 am
This should install the supported Python 3 Version on Debian.

Code: Select all

sudo apt-get update
sudo apt-get install python3
But not any python modules that OP may have installed manually.

DeaD_EyE
Posts: 66
Joined: Sat May 17, 2014 9:49 pm

Re: Python Lib Prefixes

Fri Jun 24, 2022 8:47 am

You can get a list of all as installed marked packages:

Code: Select all

dpkg -l | egrep 'ii\s+python3-' | awk '{print $2}'
To replace the line endings (there is maybe a better solution):

Code: Select all

dpkg -l | egrep 'ii\s+python3-' | awk '{print $2}' | tr -s "\n" " "
Output on my RP0W (it 's not a fresh install):
python3-apt python3-astroid python3-asttokens python3-automationhat python3-backcall python3-blinker python3-blinkt python3-bs4 python3-buttonshim python3-cairo:armhf python3-cap1xxx python3-certifi python3-cffi-backend:armhf python3-chardet python3-click python3-colorama python3-colorzero python3-cryptography python3-cups:armhf python3-cupshelpers python3-dbus python3-debconf python3-decorator python3-dev python3-distro python3-distutils python3-docutils python3-drumhat python3-envirophat python3-explorerhat python3-flask python3-fourletterphat python3-gi python3-gi-cairo python3-gpiozero python3-html5lib python3-idna python3-ipython python3-ipython-genutils python3-isort python3-itsdangerous python3-jedi python3-jinja2 python3-jwt python3-lazy-object-proxy python3-ldb python3-lib2to3 python3-libgpiod:armhf python3-logilab-common python3-lxml:armhf python3-markupsafe python3-mccabe python3-microdotphat python3-minimal python3-mote python3-motephat python3-mypy python3-mypy-extensions python3-numpy python3-oauthlib python3-olefile python3-openssl python3-pantilthat python3-parso python3-pexpect python3-pgzero python3-phatbeat python3-pianohat python3-picamera python3-pickleshare python3-piglow python3-pigpio python3-pil:armhf python3-pip python3-pkg-resources python3-prompt-toolkit python3-psutil python3-ptyprocess python3-pygame python3-pygments python3-pyinotify python3-rainbowhat python3-renderpm:armhf python3-reportlab python3-reportlab-accel:armhf python3-requests python3-requests-oauthlib python3-responses python3-roman python3-rpi.gpio python3-rtimulib python3-scrollphat python3-scrollphathd python3-send2trash python3-sense-hat python3-serial python3-setuptools python3-simplejson python3-six python3-skywriter python3-smbc python3-smbus:armhf python3-sn3218 python3-soupsieve python3-spidev python3-talloc:armhf python3-tk:armhf python3-toml python3-touchphat python3-traitlets python3-twython python3-typed-ast python3-typing-extensions python3-unicornhathd python3-urllib3 python3-venv python3-wcwidth python3-webencodings python3-werkzeug python3-wheel python3-wrapt
Then you should be able to use apt-get to install this as installed marked packages.

User avatar
rpdom
Posts: 20215
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Python Lib Prefixes

Fri Jun 24, 2022 9:35 am

DeaD_EyE wrote:
Fri Jun 24, 2022 8:47 am
You can get a list of all as installed marked packages:

Code: Select all

dpkg -l | egrep 'ii\s+python3-' | awk '{print $2}'
To replace the line endings (there is maybe a better solution):

Code: Select all

dpkg -l | egrep 'ii\s+python3-' | awk '{print $2}' | tr -s "\n" " "
That's pretty much what I would have used (maybe not awk, as I tend not to use that). The first part of your line could be changed to this

Code: Select all

dpkg -l 'python3*' | grep '^ii'
If you want it to pick up the python libraries as well (as I suspect you do, use

Code: Select all

dpkg -l '*python3*'
Then you should be able to use apt-get to install this as installed marked packages.
As the packages are already marked as installed you'd need to use the reinstall option.

This should do the trick

Code: Select all

sudo apt reinstall $( dpkg -l '*python3*' | grep '^ii' | awk '{print $2}' )
Unreadable squiggle

Return to “Python”