

Once you've installed the desired modules, you can create folders for each project inside your virtualenv environment (or create new virtualenvs for each project using the examples above) and enjoy Python 3.x. Inside this virtualenv, you must install the desired third party modules with pip:

Now, each time you do "source bin/activate" inside the virtualenv directory, you'll start your virtualenv with Python 3.4. # /usr/local/bin/virtualenv /path/to/your/virtenv3.4

# /usr/local/bin/pip3.4 install virtualenv # /usr/local/bin/pip3.4 install -upgrade distributeĬreate your isolated Python 3.4 environment (replace /path/to/your/virtenv3.4 with the desired path for Python3 development, such as /home/youruser/prog/python3.4env/): # /usr/local/bin/pip3.4 install -upgrade setuptools

Now download and install Setuptools + pip: configure -prefix=/usr/local -enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" tar.xz file and replacing -3.4 in the commands below by the proper version number): Sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-develĭownload Python 3.4 sources and compile / install them (note that any other version can be installed by downloading a different. # yum install zlib-devel bzip2-devel openssl-devel ncurses-devel zx-devel \ This minitutorial is based on a stackoverflow tutorial that provided the steps for v3.2.Īs we're going to compile python3, we need to install the required development packages: But you can setup Python 3.x ( 3.4.3 in our example below) in a separate "virtualenv" environment, not affecting the system packages and allowing you to develop Python 3.x programs. Here is a link to a very good and simple explanation of the alternatives command.CentOS and RedHat 6.x ship with Python 2, so you cannot/shouldn't install Python 3 at the system level (with or without the package manager). I see it with a great majority of people which i introduce to the concept. Also, there is a good chance that some will correct bad/unusual practices currently in use on their machines. It is strongly suggested that you read/learn more about the alternatives command in order to understand how it can help you better manage and use your system. The last command will ask you to choose between registered/installed alternatives.Īs always, well most of the time anyways, you can check out the manual ( linux man pages) using this simple command man alternativesĪltho this answer refers to/make use of specific Python versions, the alternatives command, it's concepts and uses remain the same regardless of version numbers. I would suggest using alternatives instead.Īs super-user ( root) run the following: # Start by registering python2 as an alternativeĪlternatives -install /usr/bin/python python /usr/bin/python2 50Īlternatives -install /usr/bin/python python /usr/bin/python3.5 60
