0

I have what I'm pretty sure is a simple problem- just wondering how I can/should resolve it. As a disclaimer, I'm not very experienced when it comes to working with the terminal, understanding what files are installed and where, etc.

As the title says, I'm working on a Mac.

I've been trying to get pandas and other related packages working on Python- my issue is that when I type:

python --version

In the terminal, I get Python 2.7.10, whereas when I type

sys.version

In Idle, I get 3.3.0. (More exactly, the message is: '3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 01:25:11) \n[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]')

From some research, I'm pretty sure the 2.7 is python which came with my Mac, and 3.3 was installed by me. I used the command

pip install pandas --user

In the terminal, which seemed to work- though, of course, when I type "import pandas" or "import numpy" in IDLE, it can't find the package. So my question is: How to either:

1) Change IDLE so it "points to" (?) version 2.7.

2) Download the latest version of Python (3.3 is outdated it seems) and then download packages for it. (And uninstall 3.3? Will that happen automatically?)

As I'm only a beginner, I don't have any real reason to prefer 2.7 or 3.x, so suitable advice on this point is appreciated as well. The more explicit instructions the better. Thanks!

Alex Zorn
  • 237
  • 2
  • 3
  • 1
    And this is why I use [Anaconda](https://anaconda.org/anaconda/python)... – Dux Jun 04 '18 at 21:56
  • There are plenty of options for handling different versions of python. Look into Pyenv, conda, virtualenv, etc.. – user3483203 Jun 04 '18 at 21:58
  • 2
    First:If you don’t need to use Python 2.7 for anything, I’d uninstall any site-packages you installed to 2.7, including `pip`, which will avoid running into this problem again. And uninstalling 3.3 to install 3.6 or 3.7 is a good idea in its own right, even though it would help this problem. – abarnert Jun 04 '18 at 22:09
  • 2
    Meanwhile, you can run `pip3` instead of `pip`, or use `python3 -m pip` instead of `pip`, or use virtual environments, or (I think… I haven’t run it in a long time) doesn’t IDLE have a GUI wrapper around `pip`?, or use Anaconda. Any of these _will_ solve your problem, unlike the stuff I mentioned in the previous comment (which are nice to do, but not sufficient on their own). – abarnert Jun 04 '18 at 22:11
  • In the terminal type `python3` to invoke version 3 instead of 2. I would recommend a more recent version of Python 3 though. You can set up a symlink to do this automatically like in this answer: https://stackoverflow.com/a/38806058/8289095 – Chris Jun 04 '18 at 22:17

0 Answers0