Installation of PIL/Pillow in PyCharm

When doing miscellaneous topics and using python scripts to process pictures, I found that the code was debugged incorrectly no matter how I debugged it. Then I changed the code and found that pil was not installed in pycharm.

Method 1: Install directly in pycharm

pycharm—>file—>setting—>Project:Desktop—>Project interpreter—>enter pil—>install package and
insert image description here
insert image description here
insert image description here
I failed. The error probably means this: because of the python interpreter and pip version selected by PyCharm

It's strange, when I tried to install it for the second time, the following interface appeared when I searched for pil.
insert image description here
Post an article: https://www.jianshu.com/p/3186452c4b53


Method 2: Use the command to install
pip install pillow

insert image description here
It shows that the pip version needs to be upgraded
(why do you need to upgrade the pip package: when the pip version is too old, many packages are not installed successfully)
use the command to upgrade pip

python -m pip install --upgrade pip

Note : There are two - in front of upgrade, don’t doubt, it’s wrong to lose one, don’t believe it, look at the picture (it’s probably just me that’s so stupid)
insert image description here
However! ! ! !
There was a problem during the installation. After Baidu, I changed a command and tried it, but it was still an error.

python -m pip install -U --force-reinstall pip

insert image description here
After thinking about it for a while, I suddenly thought that the network at home is very poor recently. I just downloaded a 2MB package for several minutes. Will the network disconnection in the middle cause the update to fail, so I opened a mobile phone hotspot and tried again. Oh, the
network
insert image description here

---------------------------------------------Dividing line--- --------------------------------------------------
When looking for a solution, I also saw a
insert image description here
--------------------------------------- ------Dividing line------------------------------------------ -----------

Next, install pillow, hahahaha, another error was reported. . . . . . .
The first time
insert image description here
, the second time ,
insert image description here
the third time
insert image description here
, the pretending was successful, hahahahaha happy.
I am a Windows 10 system, and both python3.7 and python2.7 are installed. During the installation process, I found that the command line operations are all version 3.7.

About PIL and pillow
PIL (Python Imaging Library) is a powerful and convenient image processing library for Python, and its reputation is relatively large. But only supports up to Python 2.7.

PIL official website: http://www.pythonware.com/products/pil/

Pillow is a fork of PIL, but has grown into a more dynamic image processing library than PIL itself. Currently the latest version is 3.0.0.

Pillow's Github homepage: https://github.com/python-pillow/Pillow

So I can't install pil on the command line
insert image description here


Method 3: Download the wheel file for installation

Website: https://pypi.org/project/Pillow/1.0/#history
insert image description here
insert image description here
Check online and download the file package, type in the command line window (assuming the PIL file I downloaded is stored in the E drive, the file name is Pillow-3.3.1 -cp27-cp27m-win_amd64.whl)

pip  install e:\Pillow-3.3.1-cp27-cp27m-win_amd64.whl

I originally wanted to download version 6.2.2, which supports both versions 3.7 and 2.7, but it is useless after downloading. I don't know if this method is feasible, and whether there will be problems during the installation process, it is for reference only.

pillow-6.2.2-cp27:
link: https://pan.baidu.com/s/1h53GdtMxBb6nieU2r6A0Rw
extraction code: xdvz
pillow-6.2.2-cp37
link: https://pan.baidu.com/s/1T1Kqb- h7pCpTpYLXrKUWUA
extraction code: hzmm

Guess you like

Origin blog.csdn.net/weixin_45664911/article/details/104706786