Search code examples
linuxpython-3.xdeploymentcentos7python-venv

Installing python 3 into venv?


I wish to develop and deploy python 3 codes, along with python 3 modules to OSX Yosemite and CentOS 7, both come with python 2 preinstalled.

I had installed python modules via pip and got the idea around developing with python 3 on Fedora 21, but I am not sure what's the best way to do this with OSX and CentOS.

I am aware that we can install python modules into a venv environment to keep it isolated from the system. Is it possible to have the whole python 3 environment isolated in venv and deploy that on CentOS/OSX? I have experimented this approach with Docker, but am feeling this is too much of a sledgehammer approach.

Is there a standard python way to develop python 3 code on primarily python 2 OS like OSX and CentOS without populating what's already on the system?


Solution

  • sunnz,

    $ virtualenv venv_name --python=python3
    

    Btw, if you install python3 directly in your system (OSX or CentOS) nothing bad will happen.