Create an ai
virtual environment:
pyton3.11 -m venv ai
Install module in virtual environment:
cd ai
python3.11 -m pip install Pillow
python3.11
Python 3.11.0rc2 (main, Jul 21 2023, 09:39:42) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
import Pillow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Pillow'
The Pillow was installed in /home/debian/.local/lib/python3.11/site-packages
,why python3.11 -m pip install Pillow
can’t install the module Pillow
inside ai/lib/python3.11/site-packages
?
3
Answers
Enable the virtual environment and import
PIL
:The import name for Pillow is
PIL
. Instead ofimport Pillow
, use:It seems that before pip install, you should activate venv ai.
You just only create venv ai, but it is not activated.
It will be needed before pip install.