Problem Description
Environment: CentOS6.5
You want to use PYTHON3 for development in this environment, but the CentOS6.5 default Python environment is version 2.6.6.
The previous practice is to install python3 directly from the source, replace the existing development environment, but in the subsequent use of the system found that many scripts rely on python2.6, direct replacement will cause a lot of software is not normal.
Today found a friend use virtualenv build python3 development environment, here record, also convenient I later check.
Installing Python3
The installation script is as follows:
Copy the Code code as follows:
wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz
Tar zxvf python-3.4.3.tgz
CD Python-3.4.3
./configure--prefix=/usr/local
Make && make Altinstall
After running the above command, you can see the newly compiled environment in the directory/usr/local/bin/python3.4.
Note: Here we are using make altinstall, and if you use makes install, you will see that there are two different versions of Python in the system in the/usr/bin/directory. This will lead to a lot of problems and is not easy to handle.
Build PYTHON3 development environment
1, install VIRTUALENV, can be installed through PIP, the command is as follows:
Copy the Code code as follows:
Pip Install Virtualenv
If PIP is not installed, you can install it by using the following command:
Copy the Code code as follows:
Yum Install Python-pip
2. Create a virtual environment:
Copy the Code code as follows:
Virtualenv-p/usr/local/bin/python3.4 py34env
After executing the above command, the Py34env folder is created in the current directory, which is the virtual environment that we created.
3. Activating the Virtual environment:
Copy the Code code as follows:
SOURCE Py34env/bin/activate
3.1. Installing Ipython in a virtual environment
Copy the Code code as follows:
Pip Install Ipython
3.2. Start the Ipython in a virtual environment:
Copy the Code code as follows:
Ipython
4. Exit the virtual environment
Copy the Code code as follows:
Deactivate
The above mentioned is the whole content of this article, I hope you can like.