Mostrando postagens com marcador pip. Mostrar todas as postagens
Mostrando postagens com marcador pip. Mostrar todas as postagens

quinta-feira, 30 de agosto de 2018

Some commands of pip - python package manager

In case you have the two python version installed in your system, using pip when you using python2.x and pip3 when using python3.


Installing

Using python 2.x:
$ sudo apt-get install python-pip

or, if you want to use python3:
$ sudo apt-get install python3-pip

Updating

pip
$ sudo pip install --upgrade pip

pip3
$ sudo pip3 install --upgrade pip

You can also use the above command to upgrade the pip packages, see:
$ pip install --upgrade package_name

Installing packages

pip
$ sudo pip install package_name

pip3
$ sudo pip3 install package_name


If you want install an especific package version, use the command like this example:
$ sudo pip install googlemaps==3.0.2

In case you already have this package installed, just upgrade it:
$ sudo pip install --upgrade googlemaps

Listing all of installed packages

pip:
$ sudo pip freeze

pip3
$ sudo pip3 freeze

Checking the pip version

pip
$ sudo pip --version

pip3
$ sudo pip3 --version


That's all folks!

sexta-feira, 24 de março de 2017

Erro no pip


Hoje me deparei com o seguinte erro ao executar o pip:

$ sudo pip install <pacote>
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
    from pip.download import path_to_url
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 25, in <module>
    from requests.compat import IncompleteRead
ImportError: cannot import name IncompleteRead

Para resolver o problema, basta apenas atualizar o pip com o easy_install:

$ sudo easy_install --upgrade pip

Feito isso, o pip será atualizado e resolvido o problema.

$ sudo pip

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.