I am working on mac OS X Yosemite, version 10.10.3.
I installed python2.7 and pip using macport as done in http://johnlaudun.org/20150512-installing-and-setting-pip
Based on other answers, for linux and mac you can run the following:
echo "export PATH=\"`python3 -m site --user-base`/bin:$PATH\"" >> ~/.bashrc
source ~/.bashrc
instead of python3 you can use any other link to python version: python, python2.7, python3.6, python3.9, etc.
In order to know where the user packages are installed in the current OS (win, mac, linux), we run:
python3 -m site --user-base
We know that the scripts go to the bin/ folder where the packages are installed.
So we concatenate the paths:
echo `python3 -m site --user-base`/bin
Then we export that to an environment variable.
export PATH=\"`python3 -m site --user-base`/bin:$PATH\"
Finally, in order to avoid repeating the export command we add it to our .bashrc file and we run source to run the new changes, giving us the suggested solution mentioned at the beginning.