Python2 and Python3 coexist under windows

Source: Internet
Author: User

I believe many of my friends have been searching the internet for Python multi-version coexistence issues.

Many of the statements are modified Python.exe's name is Python2.exe or Python3.exe.

But I don't always succeed in this way.

After modifying the name of the Python.exe, run Pip is always reported Fatal error in the launcher:unable to create process using ' "'.

In fact, you do not have to modify the original Python.exe name, only need to copy a Python.exe file, modify the name of Python2.exe or Python3.exe on it.

When we installed Python3 (>=3.3), the Python installation package actually installed a launcher Py.exe in the system,

The default placement is under Folder C:\Windows\, which can be used when running Python files

Py-3 hello.py or Py-2 hello.py

It is still troublesome to add the parameter -2/-3 each run, so py.exe this launcher allows you to add a description to the code,

Indicates whether this file should be run by python2 or interpreted by Python3. The way to do this is to add a line at the beginning of the code file

#! Python2

Or

#! Python3

PY hello.py

When using PIP to install the module, you can use

Py-3 pipinstall xxxx or py-2 pipinstall xxxx

Python2 and Python3 coexist under windows

Related Article

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.