Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The build and install commands you are refering to come from setup.py file right?</p> <p><strong>Setup.py</strong> (<a href="http://docs.python.org/2/distutils/setupscript.html" rel="nofollow">http://docs.python.org/2/distutils/setupscript.html</a>)</p> <p>This file is created by 3rd party applications / extensions of Python. They are not part of:</p> <ol> <li>Python source code (bunch of c files, etc)</li> <li>Python libraries that come bundled with Python</li> </ol> <p>When a developer makes a library for python that he wants to share to the world he creates a setup.py file so the library can be installed on any computer that has python. Maybe this is the <strong>MISSING STEP</strong></p> <p><strong>Setup.py sdist</strong></p> <p>This creates a python module (the tar.gz files). What this does is copy all the files used by the python library into a folder. Creates a setup.py file for the module and archives everything so the library can be built somewhere else.</p> <p><strong>Setup.py build</strong></p> <p>This builds the python module back into a library (SPECIFICALLY FOR THIS OS).</p> <p>As you may know, the computer that the python library originally came from will be different from the library that you are installing on.</p> <ol> <li>It might have a different version of python</li> <li>It might have a different operating system</li> <li>It might have a different processor / motherboard / etc</li> </ol> <p>For all the reasons listed above the code will not work on another computer. So <code>setup.py sdist</code> creates a module with only the source files needed to rebuild the library on another computer.</p> <p>What setup.py does exactly is similar to what a makefile would do. It compiles sources / creates libraries all that stuff.</p> <p>Now we have a copy of all the files we need in the library and they will work on our computer / operating system.</p> <p><strong>Setup.py install</strong></p> <p>Great we have all the files needed. But they won't work. Why? Well they have to be added to Python that's why. This is where install comes in. Now that we have a local copy of the library we need to install it into python so you can use it like so:</p> <pre><code>import mycustomlibrary </code></pre> <p>In order to do this we need to do several things including:</p> <ol> <li>Copy files to their library folders in our version of python.</li> <li>Make sure library can be imported using <code>import</code> command</li> <li>Run any special install instructions for this library. (seting up paths, etc)</li> </ol> <p>This is the most complicated part of the task. What if our library uses BeautifulSoup? This is not a part of Python Library. We'd have to install it in a way such that our library and any others can use BeautifulSoup without interfering with each other.</p> <p>Also what if python was installed someplace else? What if it was installed on a server with many users?</p> <p>Install handles all these problems transparently. What is does is make the library that we just built able to run. All you have to do is use the <code>import</code> command, install handles the rest.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload