Python Gadget usage notes

Source: Internet
Author: User

1. Pip

Pip is the official Python-recommended package management tool that uses the PIP or PIP3 commands directly in the Doc interface, such as installing Gensim:

C:\USERS\KAYAN.SJC>PIP3 Install--upgrade Gensim

2. Python2 Code conversion Python3 Tool 2to3.py

Python3 incompatible python2, sometimes need to convert Python2 code to PYTHON3, you can use Python 3 to bring a utility script called 2to3, script files in the Python installation directory \tools\scripts. For example, to convert a file to utils.py, first place utils.py and 2to3.py in the same directory, and then execute it in the Python window:

Python3 2to3.py-w utils.py

-W is to write the changed contents back to the original file.

It is important to note that when the code to be converted is in the C drive, the conversion may be problematic, possibly due to permissions.

Python2 and Python3 conversion details can be found in Https://docs.python.org/3/library/2to3.html#module-lib2to3

Python Gadget usage notes

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.