How to make Pillow recognisable by pycharm

て烟熏妆下的殇ゞ 提交于 2020-12-15 05:00:33

问题


I get the error:

ModuleNotFoundError: No module named 'PIL'

I installed PIL using pip but get the error.

I used the code below to import Pillow library:

from PIL import ImageTk,Image

Any help?


回答1:


PyCharm uses a virtual environment for every project. You may have installed PIL outside of your venv. To install it inside, do this.

  1. Open your project
  2. At the bottom of your screen, hit Terminal
  3. From there, pip install -U pillow

Note: When making the project, you may not have checked the button, Inherit global site-packages in the drop down under Project Interpreter. If you check it, all the packages on your machine will then be in the Virtual Environment.




回答2:


In my case I needed to install Pillow from my python terminal so that it is installed to the project virtual environment. That solved the problem from me



来源:https://stackoverflow.com/questions/62233609/how-to-make-pillow-recognisable-by-pycharm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!