Noah
Noah

Reputation: 25

How to delete extra pythons on Mac OS X Sierra

In the usr/bin folder, there are three versions of Pythons installed: Python, Python2.6, Python2.7 (the folder names) - not sure what version is for Python folder.

My issue, originally, was that I tried to install the module 'pandas' to run a script, python keeps telling me pandas could not be found.

'pip freeze' shows me pandas is already installed. However, I could not find pandas using python>>help>>modules.

So I suspected there are multiple pythons installed causing pip installing for one of them, but the default python is a different one.

So my questions are - 1 Which python is the default one that comes with macOS Sierra? (I can confirm pandas currently is installed for Python, not Python2.6 or Python2.7) 2 Can I remove extra Pythons that do not have pandas? 3 How can I find what it the default Python when I type 'Python...' and how to install pandas for that python?

Solved: Thanks for the comments and reply. I used "python2.7 install pip" to install pip for python2.7. Then I used command 'pip2.7 install pandas'. This way, pandas is installed for the default python. (The command 'pip install pandas' on my machine, is installing for python 2.6.)

Upvotes: 0

Views: 5626

Answers (1)

Muntaser Ahmed
Muntaser Ahmed

Reputation: 4647

  1. macOS Sierra uses Python 2.7 by default.
  2. You can uninstall a version of Python as described here. However, you shouldn't need to as long as you are managing your packages and environments. If you want to maintain more control over your projects and their packages/versions, you should take a look at virtualenv. Virtualenv creates environments that have their own installation directories that don't share packages with other virtualenv environments. This is a very popular option many people use when managing projects.
  3. You can use pip --version to see which version of Python you are installing a package for. You can also use pip list to see which packages are currently installed.

I highly recommend taking a look at virtualenv as it'll make keeping track of Python environments and their respective packages a lot easier.

Hope this helps!

Upvotes: 1

Related Questions