Using virtualenv to build a Python 3 development environment on Ubuntu

Source: Internet
Author: User
Tags virtual environment virtualenv

Ubuntu 13.04 Default Python version is 2.7, want to do python3 on its development will encounter problems. For example, to use PIP to install a package, the default is to install the Python2 package. If you want to install Python3 's package, you need to use virtualenv.

Virtualenv's official website is in http://www.virtualenv.org/en/latest/. As the official said, Virtualenv is a tool for creating a standalone python environment. The most basic problem to solve is the dependency and version of the library, as well as the indirect permissions (indirectly permisions, not quite clear).

Although the official description is not too clear, I am still a Python rookie. But in short through it can solve python2 and python3 two environments do not interfere with each other. That's what I did:

First, install VIRTUALENV, the PIP on the default Python2 line:

1 $ [sudo] pip install virtualenv

To create a virtual environment:

1 $ virtualenv -/usr/bin/python3 py3env

To activate a virtual environment:

1 $ source py3env/bin/activate

You will notice that the shell prompts lines before (py3env), so you can safely use Python3 to do the development. Download a three-party library first try it:

1 $ pip install httplib2

It's done!

If you want to exit the Python3 virtual environment, enter the command

1 $ deactivate

Can.

from:http://my.oschina.net/xiaoiaozi/blog/129769

Using virtualenv to build a Python 3 development environment on Ubuntu

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.