6

The past years I have needed python occasionally, but I have been installing versions and packages blindly using all sorts of different methods (canopy, easy_install, pip,...). This has led to the following tragic result:

$ python
python             python2.7-config   python3.4-32       pythonw2.6
python-config      python3            python3.4-config   pythonw2.7
python2.6          python3-32         python3.4m         
python2.6-config   python3-config     python3.4m-config  
python2.7          python3.4          pythonw  

Currently I want to start a new project, using a lot of different python modules. However, when installing packages like pandas (using pip) I am running into difficulties which are most likely caused by the sheer number of python installations on my machine.

My question now is how could I remove all these python installations and start afresh, without doing a complete OS re-installation as suggested here. I know this is possibly the best solution, but due to other projects I am currently working on this is currently not an option for me.

Alternatively, how could I at least create a workable python environment in which I can install the modules I need for the version I am using.

All help is greatly appreciated!

Louis

Community
  • 1
  • 1
Louis-Philippe
  • 159
  • 2
  • 9

1 Answers1

4

Let's assume you want to remove version 2.6. You can do

which python2.6

this will return the location of python2.6 in your computer. Then you can remove it.

Keep in mind that Python 2.x is shipped with OS X, so I don't think that removing it totally is a good option.

I have never tried virtualenv but this might be useful : Comprehensive beginner's virtualenv tutorial?

Community
  • 1
  • 1
meto
  • 3,425
  • 10
  • 37
  • 49
  • definitely +1 for virtualenv, esp mkvirtualenv -p `which python2.6` – ev-br Nov 03 '14 at 21:44
  • Thanks for your answers, I had indeed heard that I should be careful not to remove the original python installation, but mainly because of this I was unsure of what I could and could not touch on my system. With regards to `virtualenv` you are suggesting that I simply leave my mess as it is and create a separate environment for python? – Louis-Philippe Nov 04 '14 at 06:14
  • Basically yes. In that way you will have a clean new environment to develop. And if in the future you feel bold enough, you can then remove some of older your python versions – meto Nov 04 '14 at 13:55