2

I am very new to programming and I am trying to install the package requests to python.

In the terminal on my mac I am entering pip install requests.

I am getting the following error message.

Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: unable to load the file system codec
ImportError: No module named 'encodings'

Current thread 0x00007fff9e4ac3c0 (most recent call first):
Abort trap: 6

I would appreciate suggestions.

Davis Herring
  • 36,443
  • 4
  • 48
  • 76
Brandon
  • 21
  • 2
  • 1
    How did you install pip? – OneCricketeer Oct 23 '17 at 03:26
  • Maybe first thing to try is [this](https://stackoverflow.com/questions/19292957/how-can-i-troubleshoot-python-could-not-find-platform-independent-libraries-pr) – Paul Rooney Oct 23 '17 at 03:27
  • I am now seeing the error message. Fatal Python error: Py_Initialize: unable to load the file system codec ImportError: No module named 'encodings' – Brandon Oct 23 '17 at 03:32

1 Answers1

0

I think pip does not know where you python is. You can try to set the environment variable

export PYTHONHOME=/usr/local

If the location of your python is NOT /usr/local, get the correct location using

which python

For example, on my computer which python gives /usr/bin/python. So, I would do export PYTHONHOME=/usr/bin on my computer before using pip install.

emmanuelsa
  • 657
  • 6
  • 9