2

I accidentally downloaded python2.6.6 on my centos Virtual Machine from python.org's official download package and compiled it to source.

Now in my /usr/local/bin I have a python2.6 shell available and now if I use which python it will give me the path of /usr/local/bin instead of original python2.7's path which is /usr/bin.

Since I installed it from source, yum doesn't recognise python2.6.6 as a package and I want to get rid of it.

If I do rpm -q python it gives me a result of python-2.7.5-48.0.1.el7.x86_64

Is it possible to uninstall python2.6.6 and I will just re-point my python system variable to /usr/bin again?

paradox
  • 258
  • 4
  • 19
  • Accidentaly downloaded and compiled sounds strange hehe, one question, did you installed a rpm right? – Kalamarico Oct 23 '17 at 20:32
  • 1
    Did you checked if the compilation allows a 'make unistall'? as you did a make install – Kalamarico Oct 23 '17 at 20:34
  • yes I did not "accidentaly" downloaded and compiled the package, I have a old Django project that depends on python2.6.6 but centos 7 depends on python2.7 now, so my new working environment does not have python2.6 installed, also yum does not have python2.6 on its repository, that's why I compiled it from source. – paradox Oct 23 '17 at 20:41
  • Ok, so, take a look to this post hope will be helpful: https://stackoverflow.com/questions/31235059/how-to-downgrade-python-version-on-centos – Kalamarico Oct 23 '17 at 20:43
  • once I have downloaded the Python-2.6.6.tgz and unzipped it, I am able to run python2.6.6 from the unzipped file, does that mean I don't actually have to do the ./configure.py and make build process to compile it to source code? I do have a virtualenv environment available, should I just configure virtualenv to use uncompiled version of the python2.6.6? – paradox Oct 23 '17 at 20:55
  • the reason I want get rid of this compiled python2.6.6 version: 1.I got couple warnings and configuration erros when I compiled it, I don't want run into any trouble if I'm gona use this version in the future for a long time 2.I recently learned its not a good practice to install anything from source without using yum – paradox Oct 23 '17 at 20:59
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/157314/discussion-between-kalamarico-and-paradox). – Kalamarico Oct 23 '17 at 21:00
  • @paradox Is the version of `python` you want to remove installed as an rpm? Could you please do `rpm -q python` and edit your question, or post a reply. – user3788685 Oct 24 '17 at 19:18

1 Answers1

1

Sure, but you'll have to do it the hard way. Dig through /usr/local looking for anything Python-related and remove it. The python in /usr/bin should be revealed once the one in /usr/local/bin is removed.

Also, next time make altinstall. It will install a versioned executable that won't get in the way of the native executable.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • that's what I did to my /usr/local, I'm worried the system environment variable will cause a problem if I don't get rid of the python-->/usr/local/bin/python2.6 – paradox Oct 25 '17 at 05:58