Arch linux pip python

Python

Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. It supports multiple programming paradigms beyond object-oriented programming, such as procedural and functional programming. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many Unix variants including Linux and macOS, and on Windows.

Installation

Other versions

Previous and future versions of Python are available via the AUR, and may be useful for old applications that do not run on the current version, for programs intended to run on other versions, or just for curiosity:

  • Python 3.12: python312AUR pre-release
  • Python 3.10: python310AUR
  • Python 3.9: python39AUR
  • Python 3.8: python38AUR
  • Python 3.7: python37AUR (unmaintained)
  • Python 3.6: python36AUR (unmaintained)
  • Python 2.7: python2AUR (unmaintained)

Warning: Python versions before 3.8 have reached end of life and are unmaintained. See Status of Python versions.

Each of these packages installs a distinct binary named after the version number, e.g. python3.8 for Python 3.8, allowing multiple versions to coexist on a system. You can also use pyenv to easily install and switch between multiple versions of Python.

Extra modules/libraries for old versions of Python may be found on the AUR by searching for pythonversion without period> , e.g. searching for python38 for Python 3.8 modules.

You can also download the source for any release on the https://www.python.org/downloads/ page.

Alternative implementations

The python package installs CPython, the reference implementation of Python. However, there are also other implementations available. These implementations are usually based on older versions of Python and are not fully compatible with CPython.

Implementations available on Arch Linux include:

  • PyPy — A Python implementation written in Python. It has speed and memory usage advantages compared to CPython.
  • Jython — An implementation of the Python language written in Java. It can be used to embed Python scripting into Java programs or use Java libraries in Python programs.
  • micropython — Python for microcontrollers. It includes a small subset of the Python standard library and is optimized to run on microcontrollers and in constrained environments.
  • IronPython — An implementation of the Python programming language which is tightly integrated with .NET. It can use .NET libraries and allows .NET programs to use Python libraries.

More implementations exist. Some, such as Stackless, Pyston and Cinder are used internally at large technology companies. Others are historically notable but are no longer maintained due to improvements in the most popular implementations.

Читайте также:  Linux mint поменять ttl

Alternative shells

The python package includes an interactive Python shell/REPL which can be launched with the python command. The following shells are also available:

  • bpython — A fancy interface for the Python interpreter.
  • IPython — A powerful interactive Python shell.
  • Jupyter — A web-based computation application powered by IPython.
  • ptpython — An advanced Python REPL built with prompt-toolkit.

Package management

There are several ways to install Python packages on Arch Linux:

  • Official repositories and AUR — A large number of popular packages are available in the Arch repositories. This is the preferred way to install system-wide packages.
  • pip(1) — The official package installer for Python. You can use pip to install packages from the Python Package Index and other indexes.
  • pipx — Closely related to pip, but creates, for the user running it, an isolated environment for each application and its associated packages, preventing conflicts with system packages. Focused on packages that can be run from the command line directly as applications. You can use pipx to install packages from the Python Package Index and other indexes.
  • Poetry — Python dependency management and packaging made easy. It manages virtual environments, building and distribution of packages from the Python Package Index, and so it is a single command alternative to pip plus other separate tools.
  • Anaconda — An open source package management system and environment management system, originally created for Python programs. You can use Conda to install packages from the Anaconda repositories.
  • Miniconda — A lightweight alternative to Anaconda which installs the package manager but does not install scientific computing packages by default.

When installing packages using pip, it is recommended to use a virtual environment to prevent conflicts with system packages in /usr . Alternatively, pip install —user can be used to install packages into the user scheme instead of /usr . Other tools including pipx, poetry and Conda integrate environment management into their workflows.

See the Python Packaging User Guide for the official best practices for package management.

Historically, easy_install (part of python-setuptools ) was used to install packages distributed as Eggs. easy_install and Eggs have been replaced with pip and Wheels. See pip vs easy_install and Wheel vs Egg for more information.

Note: There are also tools integrating pip with pacman by automatically generating PKGBUILDs for specified PyPI packages: see Creating packages#PKGBUILD generators.

Tip: pipenv provides a single CLI for Pipfile, pip and virtualenv. It is available as python-pipenv .

Widget bindings

The following widget toolkit bindings are available:

  • Tkinter — The standard Python interface to the Tk GUI toolkit.
  • Qt for Python (PySide2) — The official Python bindings for Qt5.
  • Qt for Python (PySide6) — The official Python bindings for Qt6.
  • pyQt — A set of Python bindings for Qt.
  • PyGObject — Python bindings for GObject based libraries such as GTK, GStreamer, WebKitGTK, GLib, and GIO.
  • wxPython — A cross-platform GUI toolkit for Python which wraps wxWidgets.
Читайте также:  List folder by size linux

To use these with Python, you may also need to install the associated widget toolkit packages (e.g. tk must also be installed to use Tkinter).

Tips and tricks

Virtual environment

Python provides tools to create isolated virtual environments into which packages may be installed without conflicting with other virtual environments or the system packages. Virtual environments can also run applications with different versions of Python on the same system.

Tab completion in Python shell

Tab completion is available in the interactive shell by default. Note that the readline completer will only complete names in the global namespace. You can use python-jedi for a richer tab completion experience [1].

Troubleshooting

Module not found after Python version update

A Python-based application might output No module named module_name for an installed dependency named module_name after having upgraded the python package to a new minor version (e.g. from version 3.10 to 3.11).

The above scenario happens when a dependency is not available for that Python version or not installed at all. Python packages are installed in a versioned site-packages directory ( /usr/lib/pythonX.Y/site-packages if system-wide, or ~/.local/lib/pythonX.Y/site-packages/ if per-user, where X.Y is a version like «3.11»). So whenever there is a new minor version upgrade, the Python-based package built with previous Python version must be rebuilt against the new one in order to be properly used.

Please notice it is the user’s responsibility to rebuild non-official packages, including Python-based packages installed from AUR. See AUR#Updating packages and FAQ#What if I run a full system upgrade and there will be an update for a shared library, but not for the applications that depend on it?

See also

Official

Third-Party

  • Automate the Boring Stuff with Python — Creative Commons book
  • Awesome Python — A curated list of Python resources
  • A Byte of Python — Creative Commons book
  • Cracking Codes With Python — Free online book
  • Crash into Python — Free tutorial
  • Debugging in Python [dead link 2023-05-06 ⓘ] — Guide to using pdb , the Python debugger
  • Dive Into Python — Creative Commons book
  • Fluent Python — Commercial book
  • Introducing Python — Commercial book
  • Invent Your Own Computer Games with Python — Free online book
  • Learn Python — Free interactive tutorial
  • Learn Python the Hard Way — Commercial book
  • Pythonspot Python Tutorials — Free online tutorials
  • Think Python — Creative Commons book

Источник

OPTIONS

—debug Let unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr.

-q, —quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).

—keyring-provider Enable the credential lookup via the keyring library if user input is allowed. Specify which mechanism to use [disabled, import, subprocess]. (default: disabled)

—exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.

—trusted-host Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS.

Читайте также:  Open embedded linux entertainment center

—cert Path to PEM-encoded CA certificate bundle. If provided, overrides the default. See ‘SSL Certificate Verification’ in pip documentation for more information.

—client-cert Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.

—disable-pip-version-check Don’t periodically check PyPI to determine whether a new version of pip is available for download. Implied with —no-index.

COMMANDS

pip-install(1) Install packages. pip-download(1) Download packages. pip-uninstall(1) Uninstall packages. pip-freeze(1) Output installed packages in requirements format. pip-list(1) List installed packages. pip-show(1) Show information about installed packages. pip-check(1) Verify installed packages have compatible dependencies. pip-search(1) Search PyPI for packages. pip-wheel(1) Build wheels from your requirements. pip-hash(1) Compute hashes of package archives. pip-help(1) Show help for pip commands.

AUTHOR

Package name: extra/python-pip Version: 23.1.2-1 Upstream: https://pip.pypa.io/ Licenses: MIT Manuals: /listing/extra/python-pip/ Table of contents

Powered by archmanweb, using mandoc for the conversion of manual pages.

The website is available under the terms of the GPL-3.0 license, except for the contents of the manual pages, which have their own license specified in the corresponding Arch Linux package.

Источник

Getting Started with PIP on ArchLinux

PIP is a large suite of tools that are used to automate the installation and management of python packages and modules. The name pip is an acronym for PIP Install Packages. It is essentially a package manager for non-standard python packages, those not included in the standard python library.

Every developer who’s ever worked python will tell you that the community packages are a must. Having PIP at your disposal when working with python saves you a lot of time scouring for updates on the web.

In this post, you’ll learn all about setting up PIP on ArchLinux.

Install PIP on ArchLinux

Enter the following command to download PIP with pacman:

$ sudo pacman -S python2-pip #Python 2

$ sudo pacman -S python-pip #Python 3

Getting started with PIP

Take a minute and read the PIP help page, which lists PIP commands and their functions. Type in the following to get details on PIP commands:

Let’s discuss some of these commands:

To install a package, you’d use the following command syntax:

For example, to download the pprintpp package, you’d type in:

The command to uninstall a package is quite similar:

You can also lookup a package’s details with the following command:

Wrapping up

That’s all we have for you today. In this short guide, you’ve learned how to install PIP on ArchLinux. The CLI interface is pretty straightforward, and you’ll get used to it in just a matter of time.

The community packages are undoubtedly a great asset for any python developer. PyPI features an ever-growing list of cool new modules for you to make your work a lot easier. PIP is going to come in real handy if you want to avail of these packages.

About the author

Younis Said

I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.

Источник

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