Python installs third-party libraries, modules, and package installation methods

Source: Internet
Author: User

A lot of useful modules have been built into Python, and these modules can be used immediately as long as Python's development tools are installed. In the actual Python development process, in addition to Python built-in modules, Python also has a large number of third-party libraries, modules and packages. The common third module will be in Python'spypi-the Python Package IndexRegistration, you can install it by locating the name of the corresponding module. Because of the recent need to create PDF documents through Python, but because of the relevant modules in Python's built-in modules, you need to use a third-partyReportlabLibraries authoring Create a PDF document. Because of the first installation of third-party libraries, so toss for a long time, so the installation of the method of sorting out.
First, the installation tool is currently used in Python installation using the steup.py or Pip tool, the PIP tool is recommended in Python. The versions that follow the python3.4 include the PIP by default.     Using the Windows system, the Python development tools are installed into the C:\PYTHON33 directory (1) to install PIP in order to install PIP, first download the get-pip.py script and then execute the get-pip.py script to install PIP.     get-pip.py script: get-pip.py. Put the get-pip.py script in the C:\Python33\Tool directory, or you can put it in a different directory. Execute in cmd: Python get-pip.py after executing the command, you can install the PIP tool. The get-pip.py supports additional options that can be installed directly by default. (2) Update for PIP: python-m pip install-u pip
(3) Add environment variable after installing PIP, you will find that there are more pip.exe in C:\Python33\Scripts, in order to facilitate running Pip in cmd, you need to add the path "C:\Python33\Scripts" of the PIP in the environment variable path.
Second, install the third-party module to find the name of the Reportlab module in PyPI, Reportlab's name is Reportlab 3.1.44. Since the environment variable has been added, it can be applied directly. Execute in cmd: Pip install Reportlab due to GFW's credit, the Reportla module has been installed successfully after the patient has finished executing. If you are prompted to install the timeout or the failure can be re-executed again.    After successful execution, you will see more Reportlab directories in the C:\Python33\Lib\site-packages. This is the time to use the Reportlab module.
#!/usr/bin/python#filename creatpdf.pyfrom Reportlab.pdfgen Import canvasdef creatpdf (c):    c.drawstring (100, 100, "Using Reportlab") c = Canvas. Canvas ("Test.pdf") Creatpdf (c) c.showpage () C.save ()
After execution, a named Test.pdf is created with the content "using Reportlab"

Python installs third-party libraries, modules, and package installation methods

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.