Next, we will find that the “from PIL import Image” in Pycharm still reports an error. Next, we will click file-& GT; settings-> Project Interpreter, double-click PIP, search Pillow, click Pillow, and there will be Install in the lower left corner, and the installation is successful.
As for pillow’s installation, please refer to the following one, but I personally think it can be installed directly in File -> settings-> Search the Pillow and Image installation in the Project Interpreter
PIL: Python Imaging Library is already the DE facto standard Library of image processing for the Python platform.
However, when we do image processing, we will report the exception of PIL in No Module Named. There is no library for image processing. Since Python2.7 doesn’t ship with the library, we’ll have to load and manipulate it ourselves. However, there is a lot of information on the Internet, no specific explanation. To save everyone time and not to be misled, I’ll write down the complete solution.
1. Install easy_install
Why install easy_install?
normally, to install a third-party extension for Python, you download the package, unzip it to a directory, open it at the command line or terminal, and then execute Python setup.py install to install it. It’s very tedious. It’s convenient to wrap Twisted if we run easy_install Twisted directly from the command line. So easy_install is meant to make it easier for us to install third-party extensions.
Easy_install download path: https://github.com/ActiveState/ez_setup
Unzip the package, open the command line, and execute Python ez_setup.py
2. Install the PIP
Installing the Python package is indeed the most convenient and quick way to install PIP, because it downloads files directly from PyPI, ensures security and reliability, and is rich in resources. PIP is a tool for installing and managing Python packages.
Download path: https://github.com/pypa/pip
Unzip the package, open the command line, and execute Python Setup.py install
Normally, it should be unzipped in your Python installation path, just for the sake of illustration. After PIP is installed, there is a scripts folder under our Python installation path, and we need to configure PIP’s environment variable, which is too easy to configure, So I won’t show you.
3. The next step is to install PIL
Download path: http://www.lfd.uci.edu/~gohlk/Python libs
Before installing PIL, we need to install the wheel package. Wheel is essentially a compressed format package. Installation of python modules.
Execute PIP Install wheel from the command line, because I’ve already installed it and it doesn’t show up very well.
Next, we can install our PIL. Execute PIP Install Lion-4.1.0-cp27-cp27m-win_amd64.WHl
Because I’ve already installed it, I can’t show it well. When we install PIL successfully, it will prompt Successfully.
Let me show you how to install the WHL file:
If you add the D:\Python27\Scripts directory to your path, you can just open a CMD window with the administrator in the directory where the WHL file is located and execute the following statement directly. WHL
PIP install clip-4.1.0-cp27-cp27m-win_amd64. WHL
otherwise, you will need to run the PIP command in the D:\ pyth27 \Scripts directory with the administrator open CMD, The file name should be written to the full path)
PIP install C:\Users\ XXX \Downloads\ cites-4.1.0-cp27-cp27m-win_amd64. WHL
4. Installation is complete
So far, our PIL module has been successfully installed. We will be able to use it in python2.7.
To introduce PIL, the code is from PIL import Image.
5. At the end
Although python2.7 and python3.0 are not very different from each other, compatibility issues are unavoidable. For example, there is built-in PIP above 3.0, and not at 2.7. So we’re going to do the operation. But since I’m used to using python2.7, I need to download files and operations. Hopefully this article will help you who are still using python2.7.
- “Could not import PIL.Image . The use of array_ to_ The solution of img requires PIL. “
- Mac python install PIL
- Ueditor paste word image and upload image file automatically
- VTK cultivation 26: basic operation of image_ Three dimensional image slice extraction
- Python failed to use PIL writer library. TTF, etc. oserror: cannot open resource
- Data analysis to obtain Yahoo stock data: some problems are encountered when using panda datareader (cannot import name ‘is_ list_ Like ‘problem)
- Solve the problem of pychar import error
- An error is reported about import Java. SQL. *; problem
- Ant Design upload listtype = “picture card” realizes multi image upload and click preview image encapsulation
- The fastest way to solve the problem of error reporting from crypto.cipher import AES
- [docker] error in deleting image: image is referenced in multiple repositories
- Solved! The new version of statsmodels has the problem of importerror: cannot import name ‘factorial’
- numpy.core.umath How to solve the problem of failed to import
- Solve the problem of raspberry pie using GStreamer. Importerror: cannot import name XXX introspection typelib not found
- Problem solving module ‘ tensorflow.compat . V2 ‘has no attribute’ contrib ‘and importerror cannot import name’ auto ‘
- Python_ Part 2 programming problems (3)_ solve numpy.core.multiarray Failed to import problem
- Solve the problem of import Cafe: runtimewarning: numpy.dtype Size changed, may indicate binary instability
- ImageIO.read () unsupported image type when reading picture_ exception Unsupported Image Type
- Attributeerror: ‘module’ object has no attribute ‘handlers’ — Python sub module import problem
- Import error, failed to import the debug version of PYD