Use Virtualenv in CentOS6.5 to build the Python3 Development Environment
Problem description
Environment: CentOS6.5
To use Python3 for development in this environment, the default Python environment for CentOS6.5 is 2.6.6.
Previously, Python3 was directly installed from the source code to replace the existing development environment. However, during subsequent use, many scripts in the system depend on Python2.6. direct replacement may result in abnormal software.
Today, I found a friend using Virtualenv to build the Python3 development environment. It is recorded here for my reference.
Install Python3
The installation script is 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 preceding command, you can view the newly compiled environment in the/usr/local/bin/python3.4 directory.
Note: here we use make altinstall. If you use make install, you will see two different versions of Python in the/usr/bin/directory. This will lead to a lot of problems and will be difficult to solve.
Build python3 Development Environment
1. Run the following command to install virtualenv:
Pip install virtualenv
If pip is not installed, run the following command to install it:
Yum install python-pip
2. Create a virtual environment:
Virtualenv-p/usr/local/bin/python3.4 py34env
After executing the preceding command, the py34env folder is created in the current directory, which is the virtual environment we created.
3. Activate the virtual environment:
Source py34env/bin/activate
3.1 install ipython in a Virtual Environment
Pip install ipython
3.2 start ipython in a virtual environment:
Ipython
4. Exit the Virtual Environment
Deactivate
You may also like the following article about Python:
Python: Search for files that meet the conditions in a specified directory
Python2.7.7 source code analysis
Directly run Python code without the need for the operating system
Install Python3.4 on CentOS source code
Python core programming version 2. (Wesley J. Chun). [Chinese version of hd pdf]
Python development technology details. (Zhou Wei, Zong Jie). [hd PDF scan version + book guide video + code]
Obtain Linux information using a Python script
Build a desktop algorithm transaction research environment using Python in Ubuntu
A Brief History of Python Development
Python details: click here
Python: click here
This article permanently updates the link address: