python3.x Configuring a native virtual environment

Source: Internet
Author: User
Tags virtual environment

Python 3.4 supports native virtual environment configurations (3.3 of virtual environments do not support PIP), and the configuration process is recorded as a memo.

1. Create a virtual environment

In the console, use the CD directory to switch to the directory where you want to create the virtual environment.

Use the following command to create a virtual environment in the current directory.

Python-m venv <name>

Such as

Python-m venv venv

After the successful creation, in the directory, there are the following files:

Windows:

2. Activating the virtual environment

Switch to the directory where the virtual environment was created successfully, and execute the following command to activate the virtual environment

Windows:

Scripts\activate.bat

After the activation succeeds, the name of the virtual environment is displayed in the console.

3. Installing packages in a virtual environment

In case of successful activation of the virtual environment, install the package online using the following command

Install <package>

For example, installing Pika

Install Pika

For downloads to a local installation package, also in the case of activating the virtual environment, use the CD command to switch to the directory where the package is located, using a command similar to the following to install

Install

After the installation is successful, use the PIP List command to view the installed packages

PIP List

4.Pycharm Switch to Virtual environment

In the location, switch to the virtual environment directory.

python3.x Configuring a native virtual environment

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.