GNU/Linux >> Linux Esercitazione >  >> Panels >> Panels

Come installare pip su Ubuntu 18.04

In questo tutorial, ti mostreremo come installare pip su un VPS Ubuntu 18.04.

Pip è un sistema di gestione dei pacchetti che può essere utilizzato per installare e gestire i pacchetti scritti in Python. Python è un linguaggio di programmazione che consente di eseguire sviluppo web, sviluppo software, amministrazione di sistema, analisi di dati scientifici e numerici e molto altro. Il Python Package Index (PyPI) ospita migliaia di moduli di terze parti per Python e puoi installare uno qualsiasi di questi moduli usando il gestore di pacchetti pip. Installare Pip su Ubuntu 18.04 è un compito molto semplice e, se segui attentamente le nostre istruzioni, avrai pip installato sul tuo Ubuntu 18.04 VPS in pochi minuti. Iniziamo con l'installazione.

Prerequisiti:

  • Un VPS Ubuntu 18.04
  • Accesso all'account root oa un utente con privilegi sudo.

Fase 1:connettiti al server

Per connetterti al tuo server tramite SSH come utente root, usa il seguente comando:

ssh root@IP_ADDRESS -p PORT_NUMBER

e sostituisci "IP_ADDRESS" e "PORT_NUMBER" con l'indirizzo IP del tuo server effettivo e il numero di porta SSH. Se necessario, puoi utilizzare il nome utente di un account amministratore al posto della parola "root".

Una volta effettuato l'accesso, assicurati che il tuo server sia aggiornato eseguendo i seguenti comandi:

apt update
apt upgrade

Passaggio 2:installa pip per Python 3

Python 3 è la versione predefinita fornita con Ubuntu 18.04. Per verificare se pip per Python 3 è già installato sul tuo server, esegui il seguente comando:

pip3 -V

Se pip3 non è installato, otterrai il seguente output:

Command 'pip3' not found, but can be installed with:

apt install python-pip3

Ora possiamo installare pip3 eseguendo il seguente comando:

apt install python-pip3

Dopo che l'installazione è stata completata, ora puoi controllare di nuovo se pip3 è stato installato correttamente con:

pip3 -V

Se pip3 è stato installato correttamente, dovresti ottenere il seguente output sullo schermo:

pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

Fase 3:installa pip per Python 2 (opzionale)

Se vuoi usare Python 2 invece della versione predefinita di Python 3 sul tuo server Ubuntu 18.04, puoi invece seguire queste istruzioni.

Innanzitutto, controlla se pip (per Python 2) è installato sul tuo server con:

pip -V

Se pip non è installato, otterrai il seguente output:

Command 'pip' not found, but can be installed with:

apt install python-pip

Per installare pip e Python 2 sul tuo server, esegui il seguente comando:

apt install python-pip

Al termine dell'installazione, puoi verificarla con il seguente comando:

pip -V

Sullo schermo dovrebbe essere visualizzato il seguente output:

pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

Fase 4:comandi pip3 di base

Ora che hai installato con successo pip3 sul tuo server, ti mostreremo come usarlo esaminando alcune nozioni di base.

La sintassi di base per pip3 è la seguente:

pip3 <command> [options]

Ecco alcuni comandi utili per iniziare a usare pip3.

Per cercare un pacchetto, esegui il seguente comando:

pip3 search package_name

Per installare un pacchetto:

pip3 install package_name

Per elencare tutti i pacchetti installati:

pip3 list

Per disinstallare un pacchetto:

pip3 uninstall package_name

Per ulteriori opzioni di pip3 ed esempi di utilizzo, puoi eseguire il comando seguente:

pip3 --help

Usage:
pip <command> [options]

Commands:
install                     Install packages.
download                    Download packages.
uninstall                   Uninstall packages.
freeze                      Output installed packages in requirements format.
list                        List installed packages.
show                        Show information about installed packages.
check                       Verify installed packages have compatible dependencies.
search                      Search PyPI for packages.
wheel                       Build wheels from your requirements.
hash                        Compute hashes of package archives.
completion                  A helper command used for command completion.
help                        Show help for commands.

General Options:
-h, --help                  Show help.
--isolated                  Run pip in an isolated mode, ignoring
                            environment variables and user configuration.
-v, --verbose               Give more output. Option is additive, and can be
                            used up to 3 times.
-V, --version               Show version and exit.
-q, --quiet                 Give less output. Option is additive, and can be
                            used up to 3 times (corresponding to WARNING,
                            ERROR, and CRITICAL logging levels).
--log <path>                Path to a verbose appending log.
--proxy <proxy>             Specify a proxy in the form
                            [user:passwd@]proxy.server:port.
--retries <retries>         Maximum number of retries each connection should
                            attempt (default 5 times).
--timeout <sec>             Set the socket timeout (default 15 seconds).
--exists-action <action>    Default action when a path already exists:
                            (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
--trusted-host <hostname>   Mark this host as trusted, even though it does
                            not have valid or any HTTPS.
--cert <path>               Path to alternate CA bundle.
--client-cert <path>        Path to SSL client certificate, a single file
                            containing the private key and the certificate
                            in PEM format.
--cache-dir <dir>           Store the cache data in <dir>.
--no-cache-dir              Disable the cache.
--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.

E se vuoi ottenere maggiori informazioni su qualsiasi comando specifico, puoi usare il seguente comando:

pip3 <command> --help

Congratulazioni:ora hai installato un'istanza di Pip e ne sai di più su come utilizzarla.

Ovviamente, non devi installare pip su Ubuntu 18.04 se utilizzi uno dei nostri servizi di hosting VPS Python, nel qual caso puoi semplicemente chiedere ai nostri esperti amministratori Linux di installare pip su Ubuntu 18.04 per te. Sono disponibili 24 ore su 24, 7 giorni su 7 e si prenderanno immediatamente cura della tua richiesta. Abbiamo anche pubblicato un post su Come installare pip su Ubuntu 20.04.

PS. Se ti è piaciuto questo post su come installare pip su Ubuntu 18.04, condividilo con i tuoi amici sui social network utilizzando i pulsanti qui sotto, o semplicemente lascia una risposta in basso nella sezione commenti. Grazie.

Ecco un link alla nostra nuova versione:Come installare pip su Ubuntu 20.04.


Panels
  1. Come installare Pip su Ubuntu 16.04

  2. Come installare R su Ubuntu 16.04

  3. Come installare Vai su Ubuntu 18.04

  4. Come installare pip su Ubuntu 18.04

  5. Come installare pip su Ubuntu 20.04

Come installare Pip su Ubuntu 21.04

Come installare Pip su Ubuntu 14.04

Come installare Pip su Ubuntu 16.04

Come installare Python Pip su Ubuntu 19.04

Come installare Python PIP su Ubuntu 18.04

Come installare Pip su Ubuntu 20.04