📅  最后修改于: 2023-12-03 15:33:41.687000             🧑  作者: Mango
PIL (Python Imaging Library) is a fork of the Python library PIL (Python Image Library) that adds support for opening, manipulating, and saving many different image file formats. PIL provides many image processing capabilities, such as resizing, cropping, and filtering. In this article, we will show you how to install PIL Python on your local machine.
Download the pre-built binary installer from this website. Make sure to select a version compatible with your version of Python.
Open your command prompt and navigate to the directory where you saved the installer.
Run the following command to install PIL:
pip install <path/to/your/downloaded/pillow-version.whl>
Once PIL is installed, test it by running the following code:
from PIL import Image
im = Image.open("image.jpg")
im.show()
This code should open a window displaying the image "image.jpg". If it does not, there may be an issue with your installation of PIL.
Open your terminal and navigate to your desired directory.
Run the following command to install PIL:
pip install pillow
Once PIL is installed, test it by running the following code:
from PIL import Image
im = Image.open("image.jpg")
im.show()
This code should open a window displaying the image "image.jpg". If it does not, there may be an issue with your installation of PIL.
That's it! You have now installed PIL Python on your local machine. PIL is a powerful library with many capabilities, so be sure to explore its full potential. Happy coding!