Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
392 views
in Technique[技术] by (71.8m points)

linux - How do I completely remove versions of Python I installed before I started using pyenv?

Firstly, I'm a relative beginner with Python, Linux, terminal and pyenv, so keep that in mind ;)

I learned that pyenv is a good way to manage multiple versions of Python in parallel between projects. Before I discovered that, I installed a couple versions of Python that I now would like to remove but I don't know how. I will reinstall them later using pyenv so everything's nice and neat.

I had a vague idea about which Python-versions I installed using altinstall in addition to the system: Python 3.7 and 3.9. My system (Linux Mint 20.1) came with Python 2.7 and 3.8 so I would like to leave those alone. Using the terminal command:

whereis python 

I get the following output:

python: 
/usr/bin/python3.8 
/usr/bin/python2.7 
/usr/bin/python3.8-config 
/usr/lib/python3.8 
/usr/lib/python2.7 
/usr/lib/python3.9 
/etc/python3.8 
/etc/python2.7 
/usr/local/bin/python3.7 
/usr/local/bin/python3.9-config 
/usr/local/bin/python3.9 
/usr/local/bin/python3.7m 
/usr/local/bin/python3.7m-config 
/usr/local/lib/python3.8 
/usr/local/lib/python3.7 
/usr/local/lib/python2.7 
/usr/local/lib/python3.9 
/usr/include/python3.8 
/usr/share/python

In conclusion, I would like to remove Python version 3.7 and 3.9 including related packages, without breaking my installation of Linux Mint 20.1, any advice? Thanks!

question from:https://stackoverflow.com/questions/65906609/how-do-i-completely-remove-versions-of-python-i-installed-before-i-started-using

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You could type

python3.7 -c 'import site;print(site.getsitepackages())'
python3.9 -c 'import site;print(site.getsitepackages())'

to get all locations that may be deleted to uninstall those two versions.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...