1

I'm trying to install pandas on my mac as well as numpy but I seem to be stuck with a syntax error. Below are the steps I took

user@Chidieberes-MacBook ~ % sudo easy_install pip
Password:
Searching for pip
Best match: pip 21.0.1
Processing pip-21.0.1-py2.7.egg
pip 21.0.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Using /Library/Python/2.7/site-packages/pip-21.0.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

user@Chidieberes-MacBook ~ % pip install pandas
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 11, in <module>
    load_entry_point('pip==21.0.1', 'console_scripts', 'pip')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2843, in load_entry_point
    return ep.load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2434, in load
    return self.resolve()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2440, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Library/Python/2.7/site-packages/pip-21.0.1-py2.7.egg/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax

1 Answers1

0

Latest version of the pandas requires Python >= 3.7.1. See the PyPI.

According to traceback you are using Python version of 2.7.

hasanyaman
  • 328
  • 2
  • 9
  • Do you suggest I upgrade my python version? – Frank Somto Mar 10 '21 at 22:36
  • Yes, you should upgrade your Python version. Python 2 is not supported anymore. [Check here](https://www.python.org/doc/sunset-python-2/) – hasanyaman Mar 11 '21 at 08:12
  • Okay, I got that. I'm making use of anaconda and it seems to have python 3.8 installed with it, but it isn't my default python version. I would like to know if there's a way to make python 3.8 my default version using anaconda terminal instead of having to download external softwares. – Frank Somto Mar 11 '21 at 15:04
  • You can refer to this question: https://stackoverflow.com/questions/5846167/how-to-change-default-python-version – hasanyaman Mar 11 '21 at 18:47