Linux python setuptools install

How to get setuptools and easy_install?

I downloaded the ez_setup code from here: http://peak.telecommunity.com/dist/ez_setup.py and ran it, but i don’t think setuptools was properly installed. When i try to open an egg using easy_install i am getting a NameError. Any thoughts? Here is the specific error:

Traceback (most recent call last): File "C. setup.py", line 223, in easy_install eggsetup.py NameError: name 'easy_install' is not defined 

9 Answers 9

For linux versions(ubuntu/linux mint), you can always type this in the command prompt:

sudo apt-get install python-setuptools

This will automatically install easy_install .

After doing this, another install which depends on setuptools still tells me that setuptools isn’t installed!

 sudo apt-get install python3-setuptools 

please try to install the dependencie with pip, run this command:

sudo pip install -U setuptools 

2021 update:

  • easy_install no longer exists, it was replaced by pip install .
  • setuptools is built-in with Python 3. It’s the package to read package files (wheels) and do things under the hood.
  • pip is built-in with Python 3.
  • venv is built-in with Python 3.

Some operating systems (Debian) like to split packages into smaller independent packages, you may have to sudo apt-get install python3 python3-pip python3-venv to get all the executables. Nonetheless, the tools are usually available even if the command isn’t exposed, try calling python3 -m pip install . .

apt-get install python-setuptools python-pip 
apt-get install python3-setuptools python3-pip 

you’d also want to install the python packages.

I’m assuming you’re on Windows (could be wrong) but if you click the green Downloads button, it should take you to a table where you can choose to download a .exe version of setuptools appropriate for your version of Python. All that eggsetup stuff should be taken care of in the executable file.

Читайте также:  Arch linux create initrd

Let me know if you need more help.

On Ubuntu until python-distribute is something newer than 0.7 I’d recommend:

$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python 
yum install -y python-setuptools 

If you are installing from distro packages, then this probably doesn’t apply to your scenario.

recompile python

I have multiple versions of Python built from source installed, and I found I didn’t have setuptools for version 3.5. It seems like I was missing the zlib libraries when I compiled 3.5, which subsequently made the setuptools install fail quietly (to me at least). Recompiling with the zlib libs installed fixed this for me.

install from GitHub

If you are for some reason missing setuptools and have Python compiled with all the necessary libs, you should be able to install it from the GitHub repo like this:

git clone https://github.com/pypa/setuptools.git cd ./setuptools python3.5 bootstrap.py sudo python3.5 setup.py install 

Источник

Installing pip/setuptools/wheel with Linux Package Managers¶

This section covers how to install pip , setuptools , and wheel using Linux package managers.

If you’re using a Python that was downloaded from python.org, then this section does not apply. See the Requirements for Installing Packages section instead.

Note that it’s common for the versions of pip , setuptools , and wheel supported by a specific Linux Distribution to be outdated by the time it’s released to the public, and updates generally only occur for security reasons, not for feature updates. For certain Distributions, there are additional repositories that can be enabled to provide newer versions. The repositories we know about are explained below.

Also note that it’s somewhat common for Distributions to apply patches for the sake of security and normalization to their own standards. In some cases, this can lead to bugs or unexpected behaviors that vary from the original unpatched versions. When this is known, we will make note of it below.

Fedora¶

sudo dnf install python3-pip python3-wheel

To learn more about Python in Fedora, please visit the official Fedora docs, Python Classroom or Fedora Loves Python.

Читайте также:  Как начать изучение линукс

CentOS/RHEL¶

CentOS and RHEL don’t offer pip or wheel in their core repositories, although setuptools is installed by default.

To install pip and wheel for the system Python, there are two options:

    Enable the EPEL repository using these instructions. On EPEL 7, you can install pip and wheel like so:

sudo dnf install python3-pip python3-wheel
sudo dnf install python3-pip python3-wheel
sudo dnf upgrade python3-setuptools

To install pip, wheel, and setuptools, in a parallel, non-system environment (using yum) then there are two options:

  1. Use the “Software Collections” feature to enable a parallel collection that includes pip, setuptools, and wheel.
    • For Redhat, see here: https://developers.redhat.com/products/softwarecollections/overview
    • For CentOS, see here: https://github.com/sclorg

Be aware that collections may not contain the most recent versions.

sudo yum install python34u python34u-wheel

openSUSE¶

sudo zypper install python3-pip python3-setuptools python3-wheel

Debian/Ubuntu and derivatives¶

Firstly, update and refresh repository lists by running this command:

sudo apt update sudo apt install python3-venv python3-pip

Recent Debian/Ubuntu versions have modified pip to use the “User Scheme” by default, which is a significant behavior change that can be surprising to some users.

Arch Linux¶

Currently, there is no “copr” yum plugin available for CentOS/RHEL, so the only option is to manually place the repo files as described.

Table of Contents

  • An Overview of Packaging for Python
  • The Packaging Flow
  • Tutorials
  • Guides
    • Installing packages using pip and virtual environments
    • Installing stand alone command line tools
    • Installing pip/setuptools/wheel with Linux Package Managers
    • Installing scientific packages
    • Package index mirrors and caches
    • Hosting your own simple repository
    • Packaging and distributing projects
    • Including files in source distributions with MANIFEST.in
    • Single-sourcing the package version
    • Dropping support for older Python versions
    • Packaging binary extensions
    • Packaging namespace packages
    • Creating and discovering plugins
    • Using TestPyPI
    • Making a PyPI-friendly README
    • Publishing package distribution releases using GitHub Actions CI/CD workflows
    • Tool recommendations
    • Analyzing PyPI package downloads

    Previous topic

    Next topic

    © Copyright 2013–2020, PyPA.
    This page is licensed under the Python Software Foundation License Version 2.
    Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.

    The Python Software Foundation is a non-profit corporation. Please donate.

    Last updated on Jun 16, 2023. Found a bug?
    Created using Sphinx 4.5.0.

    Источник

    How to Install Setuptools for Python on Linux

    Setuptools is a fully-featured, stable, and actively maintained library that is aimed at facilitating the packaging of Python projects, which includes:

    • Python package and module definitions.
    • Distribution package metadata.
    • Test hooks.
    • Project installation.
    • Platform-specific details.
    • Python 3 support.

    It comprises enhancements to the Python disutils (distribution utilities) that enable developers to more easily build and package their Python code, particularly ones that have dependencies on other packages.

    In this guide, we illustrate how you can install the Python Setuptools package for Python on Linux.

    Install Python and Python-PIP in Linux

    The Python-setuptools package requires Python3 and PIP 3, which is a command-line program that enables you to install and manage Python packages.

    Most of the modern Linux distributions now ships with Python3 and you can verify using the following command:

    Check Python Version in Linux

    To install pip3 on Linux distributions, run the following command:

    $ sudo apt install python3-pip [On Debian, Ubuntu and Mint] $ sudo yum install python3-pip [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge --ask dev-python/pip [On Gentoo Linux] $ sudo pacman -S python-pip [On Arch Linux] $ sudo zypper install python3-pip [On OpenSUSE]

    To confirm pip3 has been installed, execute the command:

    Check Python PIP Version in Linux

    Install Setuptools for Python in Linux

    With Python3 and pip3 installed, proceed and install the setuptools package as shown using pip as follows.

    When the installation is complete, confirm that the setuptools package is installed.

    $ pip3 list | grep -i setuptools setuptools 45.2.0 

    In addition, you can access the Python shell and try to import the setuptools package as shown.

    Check Python Setuptools in Linux

    This is a confirmation that the Setuptools package for Python is installed.

    That was a brief guide on how to install the Setuptools package for Python on Linux distributions. Your feedback is much welcome.

    Источник

Оцените статью
Adblock
detector