Как установить easy install
Как устанавливать пакеты в Python — с PIP и без
Прежде чем что-то устанавливать, давайте разберёмся, что такое пакет, чем он отличается от модуля, и как с ним работать. У слова «пакет» применительно к Python два значения.
Установка PIP для Python 3 и 2
Если вы используете виртуальные окружения на базе venv или virtualenv, pip уже установлен. Начиная с Python 3.4 (для Python 2 — с версии 2.7.9) pip поставляется вместе с интерпретатором. Для более ранних версий устанавливать менеджер пакетов нужно вручную. Вариантов два:
C помощью скрипта get_pip.py — быстро.
Через setuptools — кроме pip сможем использовать easy_install.
Вариант 1. Скачиваем скрипт get_pip.py и запускаем в консоли. Для этого открываем терминал через Win+R>»cmd»>OK и пишем:
Полный путь полезен и в том случае, если у вас на компьютере несколько версий Python и вы ставите пакет для одной из них.
Вариант 2. Скачиваем архив с setuptools из PYPI и распаковываем в отдельный каталог. В терминале переходим в директорию setuptools c файлом setup.py и пишем:
python setup.py install
Установка пакета в pip
Пора запустить pip в Python и начать устанавливать пакеты короткой командой из консоли:
pip install имя_пакета
Обновить пакет не сложнее:
Если у вас последняя версия пакета, но вы хотите принудительно переустановить его:
Посмотреть список установленных пакетов Python можно с помощью команды:
Найти конкретный пакет по имени можно командой «pip search». О других командах можно прочесть в справке, которая выдается по команде «pip help».
Удаление пакета Python
Когда пакет больше не нужен, пишем:
pip uninstall имя_пакета
Как установить пакеты в Python без pip
он не удаляет пакеты,
он может пытаться установить недозагруженный пакет.
Если нужно скачать пакет из альтернативного источника, вы можете задать URL или локальный адрес на компьютере:
Список пакетов, установленных через easy_install, хранится в файле easy-install.pth в директории /libs/site-packages/ вашего Python.
К счастью, удалять установленные через easy_install пакеты можно с помощью pip. Если же его нет, потребуется удалить пакет вручную и стереть сведения о нем из easy-install.pth.
Теперь вы умеете ставить и удалять пакеты для вашей версии Python.
Кстати, для тех, кто изучает Python, мы подготовили список полезных и практичных советов.
Прежде чем что-то устанавливать, давайте разберёмся, что такое пакет, чем он отличается от модуля, и как с ним работать. У слова «пакет» применительно к Python два значения.
Установка PIP для Python 3 и 2
Если вы используете виртуальные окружения на базе venv или virtualenv, pip уже установлен. Начиная с Python 3.4 (для Python 2 — с версии 2.7.9) pip поставляется вместе с интерпретатором. Для более ранних версий устанавливать менеджер пакетов нужно вручную. Вариантов два:
C помощью скрипта get_pip.py — быстро.
Через setuptools — кроме pip сможем использовать easy_install.
Вариант 1. Скачиваем скрипт get_pip.py и запускаем в консоли. Для этого открываем терминал через Win+R>»cmd»>OK и пишем:
Полный путь полезен и в том случае, если у вас на компьютере несколько версий Python и вы ставите пакет для одной из них.
Вариант 2. Скачиваем архив с setuptools из PYPI и распаковываем в отдельный каталог. В терминале переходим в директорию setuptools c файлом setup.py и пишем:
python setup.py install
Установка пакета в pip
Пора запустить pip в Python и начать устанавливать пакеты короткой командой из консоли:
pip install имя_пакета
Обновить пакет не сложнее:
Если у вас последняя версия пакета, но вы хотите принудительно переустановить его:
Посмотреть список установленных пакетов Python можно с помощью команды:
Найти конкретный пакет по имени можно командой «pip search». О других командах можно прочесть в справке, которая выдается по команде «pip help».
Удаление пакета Python
Когда пакет больше не нужен, пишем:
pip uninstall имя_пакета
Как установить пакеты в Python без pip
он не удаляет пакеты,
он может пытаться установить недозагруженный пакет.
Если нужно скачать пакет из альтернативного источника, вы можете задать URL или локальный адрес на компьютере:
Список пакетов, установленных через easy_install, хранится в файле easy-install.pth в директории /libs/site-packages/ вашего Python.
К счастью, удалять установленные через easy_install пакеты можно с помощью pip. Если же его нет, потребуется удалить пакет вручную и стереть сведения о нем из easy-install.pth.
Теперь вы умеете ставить и удалять пакеты для вашей версии Python.
Кстати, для тех, кто изучает Python, мы подготовили список полезных и практичных советов.
Установка python setuptools easy_install и работа с ним
setuptools дополнение для python на данный момент до версии 2.7 позволяющее автоматически загружать и устанавливать пакеты одной строчкой из коммандной строки или консоли для никс систем.
В состав пакета setuptools входит модуль easy_install который позволяет выполнять такие действия как автоматическая загрузка пакетов и их установка, обновление, откат до предыдущей версии.
Для использования easy_install необходимо скачать setuptools и установить, так как автоматика еще не установлена, то все делаем вручную, точнее вручную скачиваем инсталятор ставящий пакет (рассматриваем установку под виндовс)
Обращаю внимание, что setuptools как и easy_install.py доступно на текущий только для python до версии 2.7
Для загрузки переходим на страницу http://pypi.python.org/pypi/setuptools
Пролистав в самый низ странички видим таблицу с доступными пакетами для загрузки, если у нас стоит виндовс и питон 2.7, то выбираем нижний пакет с названием setuptools-0.6c11.win32-py2.7.exe
Загружаем, запускаем инсталятор, производим установку setooptools, после установки переходим в каталог в который установлен питон:
/Python27/Scripts/ и видим там easy_install.exe который запускается из коммандной строки
Теперь чтобы установить пакет достаточно набрать в коммандной строке
easy_install pyside
и будет установлена бесплатная библиотека для работы с графическим интерфейсом QT4
Дополнительные источники информации:
1) Примеры работы с Easy Install
Установка PIP для Python и базовые команды
Как любой серьёзный язык программирования, Python поддерживает сторонние библиотеки и фреймворки. Их устанавливают, чтобы не изобретать колесо в каждом новом проекте. Необходимы пакеты можно найти в центральном репозитории Python — PyPI (Python Package Index — каталог пакетов Python).
Однако скачивание, установка и работа с этими пакетами вручную утомительны и занимают много времени. Именно поэтому многие разработчики полагаются на специальный инструмент PIP для Python, который всё делает гораздо быстрее и проще.
Что такое PIP для Python?
Если вы когда-нибудь работали с командной строкой Windows и с терминалом на Linux или Mac и чувствуете себя уверенно, можете пропустить инструкции по установке.
Устанавливается ли PIP вместе с Python?
Если вы пользуетесь Python 2.7.9 (и выше) или Python 3.4 (и выше), PIP устанавливается вместе с Python по умолчанию. Если же у вас более старая версия Python, то сначала ознакомьтесь с инструкцией по установке.
Правильно ли Python установлен?
Затем введите команду:
На Linux пользователям Python 3.x следует ввести:
Если вы получили номер версии (например, Python 2.7.5 ), значит Python готов к использованию.
Если вы получили сообщение Python is not defined (Python не установлен), значит, для начала вам следует установить Python. Это уже не по теме статьи. Подробные инструкции по установке Python читайте в теме: Скачать и установить Python.
Как установить PIP на Windows.
Следующие инструкции подойдут для Windows 7, Windows 8.1 и Windows 10.
Как установить PIP на Mac
Современные версии Mac идут с установленными Python и PIP. Так или иначе версия Python устаревает, а это не лучший вариант для серьёзного разработчика. Так что рекомендуется установить актуальные версии Python и PIP.
Если вы хотите использовать родную систему Python, но у вас нет доступного PIP, его можно установить следующей командой через терминал:
Если вы предпочитаете более свежие версии Python, используйте Homebrew. Следующие инструкции предполагают, что Homebrew уже установлен и готов к работе.
Установка Python с помощью Homebrew производится посредством одной команды:
Будет установлена последняя версия Python, в которую может входить PIP. Если после успешной установки пакет недоступен, необходимо выполнить перелинковку Python следующей командой:
Как установить PIP на Linux
Если у вас дистрибутив Linux с уже установленным на нем Python, то скорее всего возможно установить PIP, используя системный пакетный менеджер. Это более удачный способ, потому что системные версии Python не слишком хорошо работают со скриптом get-pip.py, используемым в Windows и Mac.
Advanced Package Tool (Python 2.x)
Advanced Package Tool (Python 3.x)
pacman Package Manager (Python 2.x)
pacman Package Manager (Python 3.x)
Yum Package Manager (Python 2.x)
Yum Package Manager (Python 3.x)
Dandified Yum (Python 2.x)
Dandified Yum (Python 3.x)
Zypper Package Manager (Python 2.x)
Zypper Package Manager (Python 3.x)
Как установить PIP на Raspberry Pi
Как пользователь Raspberry, возможно, вы запускали Rapsbian до того, как появилась официальная и поддерживаемая версия системы. Можно установить другую систему, например, Ubuntu, но в этом случае вам придётся воспользоваться инструкциями по Linux.
Начиная с Rapsbian Jessie, PIP установлен по умолчанию. Это одна из серьёзных причин, чтобы обновиться до Rapsbian Jessie вместо использования Rapsbian Wheezy или Rapsbian Jessie Lite. Так или иначе, на старую версию, все равно можно установить PIP.
На Rapsbian для Python 2.x следует пользоваться командой pip, а для Python 3.x — командой pip3 при использовании команд для PIP.
Как обновить PIP для Python
Пока PIP не слишком часто обновляется самостоятельно, очень важно постоянно иметь свежую версию. Это может иметь значение при исправлении багов, совместимости и дыр в защите.
К счастью, обновление PIP проходит просто и быстро.
Для Mac, Linux, или Raspberry Pi:
На текущих версиях Linux и Rapsbian Pi следует использовать команду pip3.
Как устанавливать библиотеки Python с помощью PIP
Если PIP работоспособен, можно начинать устанавливать пакеты из PyPI:
Установка определённой версии вместо новейшей версии пакета:
Поиск конкретного пакета:
Просмотр деталей об установленном пакете:
Список всех установленных пакетов:
Список всех устаревших пакетов:
Обновление устаревших пакетов:
Следует отметить, что старая версия пакета автоматически удаляется при обновлении до новой версии.
Русские Блоги
Как установить сторонние библиотеки в Python
Существует около трех часто используемых инструментов для установки сторонних библиотек Python:
Общий формат установочного пакета:
1. whl (рекомендуется, бинарный)
2、tar.gz
3、zip
4. Яйцо (первый распространенный формат упаковки)
напрямую изменить суффикс файлов whl и egg на zip, который можно распаковать как zip
setup.py
Setup.py часто используется для установки исходного кода. Поскольку официальный веб-сайт pypi загружает пакет очень медленно, некоторые люди предпочтут загрузить и установить его, а некоторые люди загрузят исходный код на GitHub для установки. Setup.py часто используется с последним.
установка:
1. Загрузите zip и разархивируйте;
2. Откройте cmd и введите путь после распаковки;
3. Выполните последовательно следующие коды.
Команда выглядит следующим образом:
Путь, по которому хранится установочный пакет Windows: \ Lib \ site-packages в пути установки python.
Путь для Linux должен быть: /usr/lib/python2.7/site-packages. (Путь не обязательно, в зависимости от ситуации, некоторые могут находиться в / usr / local / lib)
Недостатки:
Но этот метод установки имеет очень большую проблему, то есть пакет, установленный с помощью этого метода, не может быть полностью удален с помощью pip uninstall.
В Интернете есть способ удаления, но я пробовал его не очень эффективно:
Удалить
В общем, не рекомендуется использовать этот тип, на самом деле pip также может напрямую установить сжатый пакет, о чем мы поговорим позже.
easy_install
Если мы хотим использовать easy_install, нам сначала понадобятся инструменты настройки. Конечно, текущая версия идет вместе с ним. Python 3.6 и более поздние версии немного отличаются, что будет обсуждаться позже.
Но все же могу упомянуть:
1. Откройте официальный сайтhttp://pypi.python.org/pypi/setuptools На данный момент в последней версии есть только два формата whl и zip (раньше был exe, а сейчас вроде нет, но теперь мне кажется, что так удобнее).
Но предпосылка whl заключается в использовании pip для установки, а иногда и pip, нам может потребоваться использовать easy_install для установки, мы не часто используем easy_install с pip, поэтому мы можем загружать только zip.
2. После загрузки разархивируйте, вы найдете внутри easy_install.py и setup.py, которые можно использовать напрямую.
Если это exe-файл, дважды щелкните файл ez_setup.py, чтобы установить его после установки, или выполните команду в cmd:
После установки easy_install его можно использовать для установки пакета, но рекомендуется добавить путь easy_install в переменную среды PATH, в противном случае вам нужно будет вводить путь каждый раз при установке пакета.
Как использовать easy_install, например, установить pip, просто добавьте имя пакета напрямую:
Удалить
Обновить
использовать
Установить tar.gz и zip с помощью pip проще всего, распаковывать не нужно, первые два тоже нужно распаковать.
Пакетная установка
Иногда вы обнаружите, что если вы хотите установить файл wheel при отсутствии сети, в прямом пипе будет ошибка. Есть способ, и он может быть пакетным, который заключается в использовании файла requirements.txt. Однако перед этим нам все еще нужно знать, что причина, по которой мы не можем установить файл wheel, заключается в том, что собственный питон не поддерживает загруженный файл whl.
1. Мы загрузим все пакеты, включая whl, tar.gz и т. Д.
2. Затем запишите версию пакета в файл requirements.txt и сложите их.
3. Вы можете выполнить команду напрямую или записать команду в сценарий.
Команда выглядит следующим образом:
Массовое удаление
wheel
1. Формат наименования пакета колес
Первые два представляют имя и версию пакета соответственно.Трёхэлементные кортежи, выводимые из ранее просмотренной версии колеса, представляют
py-no расширение для конкретной реализации
cp-CPython, который является широко используемой реализацией Python.
ip-IronPython, реализация Python, работающая на платформе Windows CLI.
pp-PyPy, реализация Python с JIT
jy-Jython, реализация Python, работающая на JVM
Например, py2 и py3 в белом имени запроса представляют поддержку py2.x и py3.x соответственно. Если две существуют одновременно, это означает, что поддерживаются обе версии, разделенные знаком «.».
Честно говоря, я не совсем понимаю, что это такое, знаю только, что он делится на следующие категории:
Если нет возможности определить тип abi при упаковке, сгенерированный тег abi будет отсутствовать. Если пакет Python представляет собой чистую реализацию Python, которая не полагается на конкретный abi, сгенерированный тег abi также не имеет значения.
Большая часть того, что мы загружаем, похоже на окончание mu, например cp27mu.
win32-Windows32 бит
win_amd64 —— 64-разрядная версия Windows.
linux_i386-Linux 32 бит
linux_x86_64 —— Linux64 бит
любой —— любой
2. Какие типы файлов wheel поддерживает среда Python?
Просмотреть версии ниже pip10:
Просмотреть версии выше pip10:
Вы можете увидеть картинку:
Как видите, это список кортежей из нескольких групп. Вам знакомы три элемента в нем? Давайте посмотрим на имя файла колеса, например запросы:
Конечно, последнее невозможно увидеть при выполнении на Python в Windows.
Скачать исходный код
Источник загрузки внутреннего официального сайта pypi иногда медленный, мы можем указать источник
Домашние зеркала на данный момент имеют:
Адрес загрузки сторонней библиотеки
Различия в методах установки pip до и после python3.6
Существует большая разница между Python 3.6 и предыдущими версиями (включая 2.x и 3.x до 3.6). После установки каталог Scripts пуст, и возникает ошибка, когда мы хотим выполнить пакет обновления:
conda
Когда я познакомился с python через 16 лет, изучение поисковых роботов было почти прекращено из-за установки сторонних библиотек, особенно фреймворка Scrapy.Позже я обнаружил такую хорошую вещь с Anaconda через некоторое время.
Если вы хотите установить Anaconda для py2 и py3 вместе, просто установите один из них в другой уже установленный путь envs.
virtualenv
Что касается установочного пакета, если вы чувствуете, что его все равно нельзя установить, использование виртуальной среды также является хорошим выбором.
Easy Install¶
Easy Install is deprecated. Do not use it. Instead use pip. If you think you need Easy Install, please reach out to the PyPA team (a ticket to pip or setuptools is fine), describing your use-case.
Easy Install is a python module ( easy_install ) bundled with setuptools that lets you automatically download, build, install, and manage Python packages.
Please share your experiences with us! If you encounter difficulty installing a package, please contact us via the distutils mailing list. (Note: please DO NOT send private email directly to the author of setuptools; it will be discarded. The mailing list is a searchable archive of previously-asked and answered questions; you should begin your research there before reporting something as a bug – and then do so via list discussion first.)
(Also, if you’d like to learn about how you can use setuptools to make your own packages work better with EasyInstall, or provide EasyInstall-like features without requiring your users to use EasyInstall directly, you’ll probably want to check out the full documentation as well.)
Using “Easy Install”¶
Installing “Easy Install”¶
Please see the setuptools PyPI page for download links and basic installation instructions for each of the supported platforms.
You will need at least Python 3.5 or 2.7. An easy_install script will be installed in the normal location for Python scripts on your platform.
Note that easy_install normally works by downloading files from the internet. If you are behind an NTLM-based firewall that prevents Python programs from accessing the net directly, you may wish to first install and use the APS proxy server, which lets you get past such firewalls in the same way that your web browser(s) do.
Troubleshooting¶
Windows Notes¶
Installing setuptools will provide an easy_install command according to the techniques described in Executables and Launchers. If the easy_install command is not available after installation, that section provides details on how to configure Windows to make the commands available.
Downloading and Installing a Package¶
Example 1. Install a package by name, searching PyPI for the latest version, and automatically downloading, building, and installing it:
Example 2. Install or upgrade a package by name and version by finding links on a given “download page”:
Example 3. Download a source distribution from a specified URL, automatically building and installing it:
Example 5. Upgrade an already-installed package to the latest version listed on PyPI:
Example 6. Install a source distribution that’s already downloaded and extracted in the current directory (New in 0.5a9):
Example 7. (New in 0.6a1) Find a source distribution or Subversion checkout URL for a package, and extract it or check it out to
/projects/sqlobject (the name will always be in all-lowercase), where it can be examined or edited. (The package will not be installed, but it can easily be installed with easy_install
Example 7. (New in 0.6.11) Install a distribution within your home dir:
Easy Install accepts URLs, filenames, PyPI package names (i.e., distutils “distribution” names), and package+version specifiers. In each case, it will attempt to locate the latest available version that meets your criteria.
Upgrading a Package¶
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.:
a version greater than the one you have now:
using the upgrade flag, to find the latest available version on PyPI:
or by using a download page, direct download URL, or package filename:
easy_install never actually deletes packages (unless you’re installing a package with the same name and version number as an existing package), so if you want to get rid of older versions of a package, please see Uninstalling Packages, below.
Changing the Active Version¶
If you’ve upgraded a package, but need to revert to a previously-installed version, you can do so like this:
This will activate the latest installed version. (Note: if you have set any find_links via distutils configuration files, those download pages will be checked for the latest available version of the package, and it will be downloaded and installed if it is newer than your current version.)
Uninstalling Packages¶
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:
Managing Scripts¶
Thus, you do not normally need to manually delete scripts for older versions of a package, unless the newer version of the package does not include a script of the same name. However, if you are completely uninstalling a package, you may wish to manually delete its scripts.
For example, suppose you want to use two versions of the rst2html tool provided by the docutils package. You might first install one version:
Executables and Launchers¶
On Unix systems, scripts are installed with as natural files with a “#!” header and no extension and they launch under the Python version indicated in the header.
On Windows, there is no mechanism to “execute” files without extensions, so EasyInstall provides two techniques to mirror the Unix behavior. The behavior is indicated by the SETUPTOOLS_LAUNCHER environment variable, which may be “executable” (default) or “natural”.
Regardless of the technique used, the script(s) will be installed to a Scripts directory (by default in the Python installation directory). It is recommended for EasyInstall that you ensure this directory is in the PATH environment variable. The easiest way to ensure the Scripts directory is in the PATH is to run Tools\Scripts\win_add2path.py from the Python directory.
Windows Executable Launcher¶
This behavior is currently default. To force the use of executable launchers, set SETUPTOOLS_LAUNCHER to “executable”.
Natural Script Launcher¶
Tips & Techniques¶
Multiple Python Versions¶
By default, there are no host restrictions in effect, but you can change this default by editing the appropriate configuration files and adding:
The above example would then allow downloads only from hosts in the python.org and myintranet.example.com domains, unless overridden on the command line.
Installing on Un-networked Machines¶
will attempt to install SomePackage using only eggs and source packages found in somedir and disallowing all remote access. You should of course make sure you have all of SomePackage’s dependencies available in somedir.
If you have another machine of the same operating system and library versions (or if the packages aren’t platform-specific), you can create the directory of eggs using a command like this:
This will use locally-available source distributions to build the eggs.
Packaging Others’ Projects As Eggs¶
will install the package as an egg, and this:
Creating your own Package Index¶
If you are setting up an intranet site for package downloads, you may want to configure the target machines to use your download site by default, adding something like this to their configuration files:
As you can see, you can list multiple URLs separated by whitespace, continuing on multiple lines if necessary (as long as the subsequent lines are indented.
Password-Protected Sites¶
If a site you want to download from is password-protected using HTTP “Basic” authentication, you can specify your credentials in the URL, like so:
You can do this with both index page URLs and direct download URLs. As long as any HTML pages read by easy_install use relative links to point to the downloads, the same user ID and password will be used to do the downloading.
Controlling Build Options¶
EasyInstall respects standard distutils Configuration Files, so you can use them to configure build options for packages that it installs from source. For example, if you are on Windows using the MinGW compiler, you can configure the default compiler by putting something like this:
into the appropriate distutils configuration file. In fact, since this is just normal distutils configuration, it will affect any builds using that config file, not just ones done by EasyInstall. For example, if you add those lines to distutils.cfg in the distutils package directory, it will be the default compiler for all packages you build. See Configuration Files below for a list of the standard configuration file locations, and links to more documentation on using distutils configuration files.
Editing and Viewing Source Packages¶
Dealing with Installation Conflicts¶
(NOTE: As of 0.6a11, this section is obsolete; it is retained here only so that people using older versions of EasyInstall can consult it. As of version 0.6a11, installation conflicts are handled automatically without deleting the old or system-installed packages, and without ignoring the issue. Instead, eggs are automatically shifted to the front of sys.path using special code added to the easy-install.pth file. So, if you are using version 0.6a11 or better of setuptools, you do not need to worry about conflicts, and the following issues do not apply to you.)
EasyInstall will stop the installation if it detects a conflict between an existing, “unmanaged” package, and a module or package in any of the distributions you’re installing. It will display a list of all of the existing files and directories that would need to be deleted for the new package to be able to function correctly. To proceed, you must manually delete these conflicting files and directories and re-run EasyInstall.
Of course, once you’ve replaced all of your existing “unmanaged” packages with versions managed by EasyInstall, you won’t have any more conflicts to worry about!
Compressed Installation¶
The current analysis approach is fairly conservative; it currently looks for:
Any use of the __file__ or __path__ variables (which should be replaced with pkg_resources API calls)
Possible use of inspect functions that expect to manipulate source files (e.g. inspect.getsource() )
Normally, however, it is simplest to let EasyInstall handle the determination of whether to zip or unzip, and only specify overrides when needed to work around a problem. If you find you need to override EasyInstall’s guesses, you may want to contact the package author and the EasyInstall maintainers, so that they can make appropriate changes in future versions.
Reference Manual¶
Configuration Files¶
For more information, see also the current Python documentation on the use and location of distutils configuration files.
Notice that easy_install will use the setup.cfg from the current working directory only if it was triggered from setup.py through the install_requires option. The standalone command will not use that file.
Command-Line Options¶
Install all packages as zip files, even if they are marked as unsafe for running as a zipfile. This can be useful when EasyInstall’s analysis of a non-setuptools package is too conservative, but keep in mind that the package may not work correctly. (Changed in 0.5a9; previously this option was required in order for zipped installation to happen at all.)
Don’t install any packages as zip files, even if the packages are marked as safe for running as a zipfile. This can be useful if a package does something unsafe, but not in a way that EasyInstall can easily detect. EasyInstall’s default analysis is currently very conservative, however, so you should only use this option if you’ve had problems with a particular package, and after reporting the problem to the package’s maintainer and to the EasyInstall maintainers.
which will put the latest installed version of the specified packages on sys.path for you. (For more advanced uses, like selecting specific versions and enabling optional dependencies, see the pkg_resources API doc.)
Changed in 0.6a10: this option is no longer silently enabled when installing to a non-PYTHONPATH, non-“site” directory. You must always explicitly use this option if you want it to be active.
Set the installation directory. It is up to you to ensure that this directory is on sys.path at runtime, and to use pkg_resources.require() to enable the installed package(s) that you need.
Don’t install scripts. This is useful if you need to install multiple versions of a package, but do not want to reset the version that will be run by scripts that are already installed.
Use the user-site-packages as specified in PEP 370 instead of the global site-packages.
Copy all needed distributions to the installation directory, even if they are already present in a directory on sys.path. In older versions of EasyInstall, this was the default behavior, but now you must explicitly request it. By default, EasyInstall will no longer copy such distributions from other sys.path directories to the installation directory, unless you explicitly gave the distribution’s filename on the command line.
Note that as of 0.6a10, using this option excludes “system” and “development” eggs from consideration because they can’t be reliably copied. This may cause EasyInstall to choose an older version of a package than what you expected, or it may cause downloading and installation of a fresh copy of something that’s already installed. You will see warning messages for any eggs that EasyInstall skips, before it falls back to an older version or attempts to download a fresh copy.
(Note: if you want to refer to a local HTML file containing links, you must use a file: URL, as filenames that do not refer to a directory, egg, or archive are ignored.)
You may specify multiple URLs or file/directory names with this option, separated by whitespace. Note that on the command line, you will probably have to surround the URL list with quotes, so that it is recognized as a single option value. You can also specify URLs in a configuration file; see Configuration Files, above.
—no-find-links Blocks the addition of any link.
Added in Distribute 0.6.11 and Setuptools 0.7.
Set the directory used to build source packages. If a package is built from a source distribution or checkout, it will be extracted to a subdirectory of the specified directory. The subdirectory will have the same name as the extracted distribution’s project, but in all-lowercase. If a file or directory of that name already exists in the given directory, a warning will be printed to the console, and the build will take place in a temporary directory instead.
Don’t actually install the package or scripts. This option is passed down to any setup scripts run, so packages should not actually build either. This does not skip downloading, nor does it skip extracting source distributions to a temporary/build directory.
—record=FILENAME (New in 0.5a4)
Write a record of all installed files to FILENAME. This is basically the same as the same option for the standard distutils “install” command, and is included for compatibility with tools that expect to pass this option to “setup.py install”.
Don’t install any dependencies. This is intended as a convenience for tools that wrap eggs in a platform-specific packaging system. (We don’t recommend that you use it for anything else.)
—prefix=DIR (New in 0.6a10)
Normally, EasyInstall prefers to only install released versions of projects, not in-development ones, because such projects may not have a currently-valid version number. So, it usually only installs them when their setup.py directory is explicitly passed on the command line.
Note that if you use this option, you must make sure that there is a valid version number (such as an SVN revision number tag) for any in-development projects that may be used, as otherwise EasyInstall may not be able to tell what version of the project is “newer” when future installations or upgrades are attempted.
Custom Installation Locations¶
Very often though, a user or developer wants easy_install to install and manage python packages in an alternative location, usually for one of 3 reasons:
They don’t have access to write to the main Python site-packages directory.
They want a user-specific stash of packages, that is not visible to other users.
They want to isolate a set of packages to a specific python application, usually to minimize the possibility of version conflicts.
Historically, there have been many approaches to achieve custom installation. The following section lists only the easiest and most relevant approaches 1.
There are older ways to achieve custom installation using various easy_install and setup.py install options, combined with PYTHONPATH and/or PYTHONUSERBASE alterations, but all of these are effectively deprecated by the User scheme brought in by PEP-370.
Use the “–user” option¶
Prior to the User scheme, there was the Home scheme, which is still available, but requires more effort than the User scheme to get packages recognized.
Use the “–user” option and customize “PYTHONUSERBASE”¶
Use “virtualenv”¶
“virtualenv” is a 3rd-party python package that effectively “clones” a python installation, thereby creating an isolated location to install packages. The evolution of “virtualenv” started before the existence of the User installation scheme. “virtualenv” provides a version of easy_install that is scoped to the cloned python install and is used in the normal way. “virtualenv” does offer various features that the User installation scheme alone does not provide, e.g. the ability to hide the main python site-packages.
Please refer to the virtualenv documentation for more details.
Package Index “API”¶
Custom package indexes (and PyPI) must follow the following rules for EasyInstall to be able to look up and download packages:
Except where stated otherwise, “pages” are HTML or XHTML, and “links” refer to href attributes.
Omitting the /version part of a project page’s URL (but keeping the trailing / ) should result in a page that is either:
The single active version of that project, as though the version had been explicitly included, OR
A page with links to all of the active version pages for that project.
Individual project version pages should contain direct links to downloadable distributions where possible. It is explicitly permitted for a project’s “long_description” to include URLs, and these should be formatted as HTML links by the package index, as EasyInstall does no special processing to identify what parts of a page are index-specific and which are part of the project’s supplied description.
Individual project version pages should identify any “homepage” or “download” URLs using rel=»homepage» and rel=»download» attributes on the HTML elements linking to those URLs. Use of these attributes will cause EasyInstall to always follow the provided links, unless it can be determined by inspection that they are downloadable distributions. If the links are not to downloadable distributions, they are retrieved, and if they are HTML, they are scanned for download links. They are not scanned for additional “homepage” or “download” links, as these are only processed for pages that are part of a package index site.