Share steps of the python publishing Module

Source: Internet
Author: User
Tags python list

1. Create a folder nester for the module nester, which contains: nester. py (module File ):

Copy codeThe Code is as follows:
"This is the" nester. py "module, which provides a function named print_lol,
The function is used to print the list. The temperament includes the nested list """
Def print_lol (the_list ):
"This function has a location parameter named" the_list ", which can be any python list.
Each data item in the specified list is recursively output to the screen, and each data item occupies a row """
For each_item in the_list:
If isinstance (each_item, list ):
Print_lol (each_item)
Else: print (each_item)

2. Create a new setup. py file (including the elements to be released) in the netster Folder ):

Copy codeThe Code is as follows:
From distutils. core import setup
Setup (name = 'nester ',
Version = '1. 0 ',
Py_modules = 'nester ',
Author = 'nididya ')

3. Build a publishing file:

In Head First Python, we talk about the release and construction of modules in Linux.

The construction module in window encountered the following problems:

Enter python in CMD to display commands that are not internal or external.

Add the python installation directory to the PATH of the system environment variable. For example, install python on C: \ Python33.
Right-click my computer icon and choose Properties> advanced> environment variables.

In the displayed dialog box, double-click the PATH line at the top and add C: \ Python33 to the variable value column. Note that the column is separated by a semicolon.
After the problem is solved, you can proceed to the steps of the release module.

Open the directory where the nester is located in the doscommand line
Cd c: \ nester I put it under the C root directory
Copy codeThe Code is as follows:
Python setup. py sdist


 

4. Release and install it to your python local copy
Copy codeThe Code is as follows:
Python setup. py install


 
After the module is released, it can be imported and used.

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.