Reputation: 1
What is the difference between directly downloading flask-3.0.3.tar.gz
or
flask-3.0.3-py3-none-any.whl
from https://pypi.org/ and run the command pip install flask
?
I tried to download some libraries but I don't undestand if it does not matter the way I download these libraries.
Upvotes: -1
Views: 62
Reputation: 94425
pip
does a lot of things. You surely can do everything manually but pip
helps to avoid a lot of tedious manual labor.
When presented a list of wheels for different Python versions, OSes and platforms (like this one, for example) you need to download the exact wheel for your platform. pip
know its platform (it asks Python because pip
is a Python script and Python surely knows the platform it was compiled for) so pip
can select the correct one for you.
When presented with a list of versions like this you need to choose one compatible with your Python version. The version 2.1.0 in the example requires Python >= 3.7 but what if for some reason you need to run Python 3.6 — are you going to check every version manually? pip
can do that for you because it asks PyPI API. See this sessions:
$ python3.6 -m virtualenv venv-3.6
$ . venv-3.6/bin/activate
$ pip install formencode
Collecting formencode
Downloading FormEncode-2.0.1-py2.py3-none-any.whl (363 kB)
Version 2.0.1 is not the very latest version, it's the latest version compatible with Python 3.6!
pip
downloads dependencies for you. Recursively, i.e. it downloads transitive dependencies, dependencies of dependencies. In the example above:
Collecting six
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, formencode
Successfully installed formencode-2.0.1 six-1.16.0
six
was downloaded automatically as a dependency of FormEncode.
pip
can download, build and install packages from version control systems like Git:
pip install git+https://github.com/sqlobject/sqlobject.git
pip
will clone the repository, build the package and install it. No manual cloning/building.
Upvotes: 0
Reputation: 443
There is no significant difference between installing directly from PyPI or using pip
to install a package.
pip
is the package installer for Python. You can use it to install packages from the Python Package Index and other indexes.
The Python Package Index is PyPI, a repository of open-source packages where developers can distribute their own packages, modules, and software.
Upvotes: 0
Reputation: 1936
If you have internet connectivity then the simplest option is to use pip install flask
.whl files are Build files. If you want to perform an offline installation then copy the wheel file and install it using that.
pip install filename.whl
.tar.gz contains the source code, examples, docs for the library.
unzip the files and change to that directory
python setup.py install
.tar.gz option is used where .whl binary files are not allowed.
Upvotes: 0