using new modules without polluting your system
in this exercize we’re going to use pipenv
to try out some new modules without polluting your environment
start a new project called cute-python
make a new folder called cute-python
function that downloads image from web
remember to use
pipenv
for this step
we want to download a particular image from the web:
why not use an awesome library to perform our HTTP download for us?
lets see if this library is indeed so awesome without affecting our whole system.
1. use `pipenv` to install the `requests` library for the `cute-python` project
2. use the [requests](https://2.python-requests.org/en/master/) library to write a function that downloads the image file mentioned above to a file called `cute-python.jpg`
> hint: you're looking for the `requests.get()` function, <br>
> you need to write the _content_ to a binary file opened like this `open('cute-python.jpg', "wb")`
# lets also show the file
here's some code based on `matplotlib` and `pillow` modules that can show the image
import matplotlib.pyplot as plt import matplotlib.image as mpimg plt.imshow(mpimg.imread(‘cute-python.jpg’)) plt.show() ```
- lets use pipenv to get these two modules for our project
- lets add this code to a file called
show.py
and run it
what are our project’s dependencies?
- what libraries we actuall care about did we install
- what sub-dependencies were installed in addition?