Method to install easy_install under Linux

  • 2020-04-02 09:44:06
  • OfStack

If you want to use the easy_install tool, you may need to install setuptools first, but the cooler way is to use the ez_setup.py script:


wget -q http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py

After you've installed it, it's best to make sure that the directory where easy_install resides has been added to the PATH environment variable:


Windows: C:Python25Scripts
Linux: /usr/local/bin

For example, to install Python's MySQL support, you can execute the following command, the system will automatically find the relevant package in the pypi website list:


easy_install MySQL-python

If you execute the above command on Windows+python2.5, the following errors may occur:


Processing MySQL-python-1.2.3c1.tar.gz
Running MySQL-python-1.2.3c1setup.py -q bdist_egg --dist-dir c:docume~1...
locals~1tempeasy_install-fvvfveMySQL-python-1.2.3c1egg-dist-tmp-q9moxf
error: The system cannot find the file specified

This type of error is due to the wrong version. For this example, we can explicitly specify the version number of the package:


easy_install "MySQL-python==1.2.2"

By installing the software with easy_install, the installation information is saved in an easy-install.pth file along the following form:


Windows : C:Python25Libsite-packageseasy-install.pth
Linux : /usr/local/lib/python25/site-packages/easy-install.pth

If you want to remove a package installed via easy_install, such as mysql-python, you can execute the following command:


easy_install -m MySQL-python

This erases the mysql-python information from the easy-install. PTH file and removes the remaining egg file manually.


Related articles: