Python2 and Python3 are configured under WINDOWS10 and easy package management is implemented Anaconda __python

Source: Internet
Author: User
suitable for developers who want to build Python2 and Python3 coexistence environments and facilitate package management

Anaconda is a release version of Python that has a very handy package management tool Conda

Official Download Address https://www.anaconda.com/download/

Download two versions of Anaconda at the same time

the following Python2 abbreviation PY2 Python3, anaconda abbreviation Conda

Pycharm is a handy Python IDE tool, but its package management does not distinguish between Py2 and py3, and sometimes the appropriate version of the package will not be able to find an error message (installed Conda cannot be managed with Pycharm)

installation of major version Conda

First install the main version of the Conda for example, you are using Py2 developed to install the CONDA2 first installation process is the next step

To do this, check both options at the same time.

The first is to add Conda into the system variable.

The second is to set it as the main py version

So want to put Py3 as a major version of this here to first install Py3

The installation can be completed using PY2 and Conda for package management.

It's easy to use Conda for package management

You can enter the Conda will be prompted

Conda List lists the packages that can be installed

Conda Install numpy(package name) can install package

Enter Y-Enter to install and update other packages by the way

installation of Conda3

The Conda3 installation path needs to be in the Conda2 Envs directory after installing conda2 This step is important

Because you can then use the command to create a virtual Py3 operating environment

So the two hooks in this step should be removed to avoid and conda2 conflicts.

When you're done, you have py2 and py3, and you can choose between 2 and 3 in Pycharm to develop

File→setting→project Interpreter Point gear button to add compiler path after opening Pycharm

Create a project to select a version of PY

settings for System variables

First add the Py2 major version path to the system variable

You can enter Python at the command line to start the PY2 interactive environment.

You can use the PY3 environment on the command line using activate "Python3", which is based on your Py3 installation path folder, such as the folder I installed Python3.

Using the deactivate command to return to the original environment this is equivalent to two parallel worlds. It's also a Python command, but it's two different versions.

The next thing to solve is to use the two-version Conda command to differentiate the problem

Because the Conda command is in the script directory, so we're doing Conda in the directory with the Py2 version.

We can add a script to the scripts directory named Conda3 and point it to Py3 's Conda

The script contents are as follows

Later, the PY2 package is updated using Conda at the command line

The PY3 package is updated with the Conda3 command

In this way, the coexistence of py2 and PY3 environments is implemented using Conda tools for package management and the environment for project development with Pycharm

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.