Use Virtualenv in CentOS6.5 to build the Python3 Development Environment

Source: Internet
Author: User
Tags virtualenv

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.