Easy_Install Package Manager
This post will be the first in a series of "Python Packing Manager" posts. To know which one you are going to use, can be hard, as there are a few different ones to choose from. Let's start out with Easy_Install.
Distributes Python programs and libraries (based on the Python Eggs wrapper) It's a python module (easy_install) that is bundled with setuptools. It lets you automatically download, build, install, and manage Python packages. Easy_Install looks in the Python Package Index (PyPI) for the desired packages and uses the metadata there to download and install the package and its dependencies. It is also hosted itself on the PyPI.
Huevos de pitón
A Python egg is a way of distributing Python packages. "Eggs are to Pythons as Jars are to Java..." For a great introduction about this, I suggest you head over to this post
herramientas de configuración
setuptools is a collection of enhancements to the Python distutils that allow you to more easily build and distribute Python packages, especially ones that have dependencies on other packages.
Descarga e instalación de un paquete
For basic use of easy_install, you need only supply the filename or URL of a source distribution or .egg file (Python Egg). By default, packages are installed to the running Python installation's site-packages directory.
Ejemplos de Easy_Install
Install a package by name, searching PyPI for the latest version, and automatically downloading, building, and installing it: >>easy_install SQLObject Install or upgrade a package by name and version by finding links on a given "download page": >>easy_install -f http://pythonpaste.org/package_index.html SQLObject Download a source distribution from a specified URL, automatically building and installing it: >>easy_install http://example.com/path/to/MyPackage-1.2.3.tgz Install an already-downloaded .egg file: >>easy_install /my_downloads/OtherPackage-3.2.1-py2.3.egg Upgrade an already-installed package to the latest version listed on PyPI: >>easy_install --upgrade PyProtocols Install a source distribution that's already downloaded and extracted in the current directory (New in 0.5a9): >>easy_install .
Actualizar un paquete
You don't need to do anything special to upgrade a package Just install the new version, either by requesting a specific version, e.g.: >>easy_install "SomePackage==2.0"
If you're installing to a directory on PYTHONPATH, or a configured "site" directory (and not using -m), installing a package automatically replaces any previous version in the easy-install.pth file, so that Python will import the most-recently installed version by default. So, again, installing the newer version is the only upgrade step needed.
A version greater than the one you have now: >>easy_install "SomePackage>2.0" Using the upgrade flag, to find the latest available version on PyPI: >>easy_install --upgrade SomePackage Or by using a download page, direct download URL, or package filename: >>easy_install -f http://example.com/downloads ExamplePackage >>easy_install http://example.com/downloads/ExamplePackage-2.0-py2.4.egg >>easy_install my_downloads/ExamplePackage-2.0.tgz
Cambiar la versión activa
If you've upgraded a package, but need to revert to a previously-installed version, you can do so like this:
>>easy_install PackageName==1.2.3 (where 1.2.3 is replaced by the exact version number you wish to switch to. If a package matching the requested name and version is not already installed in a directory on sys.path, it will be located via PyPI and installed.) To switch to the latest installed version of PackageName: >>easy_install PackageName This will activate the latest installed version!
If you have replaced a package with another version, then you can just delete the package(s) you don't need by deleting the PackageName-versioninfo.egg file or directory (found in the installation directory).
If you want to delete the currently installed version of a package (or all versions of a package), you should first run: >>easy_install -mxN PackageName This will ensure that Python doesn't continue to search for a package you're planning to remove. After you've done this, you can safely delete the .egg files or directories, along with any scripts you wish to remove.
For more information on how to use easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall
Entrenamiento de Python recomendado
Para el entrenamiento de Python, nuestra principal recomendación es DataCamp.