python-3.xdockerpiprootsite-packages

Setting python3 PYTHONHOME


I installed python3 and pip3 using:

RUN apt install -y build-essential libssl-dev libffi-dev python3-dev
RUN apt install -y python3-pip

For some reason site-packages are showing up like this:

root@5d6f29f1d4e9:/usr/local/lib/python2.7# ls -a
.  ..  dist-packages  site-packages
root@5d6f29f1d4e9:/usr/local/lib/python3.6# ls -a
.  ..  dist-packages

My only guess is that I should set PYTHONHOME to point to 3.x instead of 2.x? e.g.:

ENV PYTHONHOME /usr/local/lib/python3.6

(note I am root user in a docker container so just need one python version and I won't need virtualenv / venv).


Solution

  • Nah I don't think this was it. I did this:

    RUN apt install -y build-essential libssl-dev libffi-dev python3-dev
    RUN apt install -y python3-pip
    
    ENV PYTHONHOME /usr/local/lib/python3.6
    
    RUN pip3 install awscli
    

    and it then failed with some unnecessary error when installing awscli, so setting this env var doesn't seem like the right thing to do.