Problems coexisting with multiple versions of Python in Windows

Source: Internet
Author: User

Original article, without my permission to the system reproduced.

In my windows, python3.4 was installed first, and later because of the need to install python2.7, the results found:

Directly double-clicking on the 1.py and command-line python 1.py using the Python interpreter is different.

Directly double-click, using the later installation of the D:\Python27\python.exe

command line input python 1.py, using the previously installed D:\Program Files (x86) \python3.4\python.exe

However, my PATH environment variable contains only 3.4 paths, and I don't know why it's so weird, but pay attention to this distinction.

the way to avoid the pit : use absolute path.

How to judge the Python interpreter in a script:

1. Write a simple print to see if it can be executed.

2. Use the dedicated version interface:

Import Platform
Print (Platform.python_version ())


Original article, without my permission to the system reproduced.

Problems coexisting with multiple versions of Python in Windows

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.