# ModuleNotFoundError: No module named 'PIL'

**URL:** <https://discuss.python.org/t/modulenotfounderror-no-module-named-pil/19723>\
**Category:** Python Help\
**Created:** [October 5, 2022, 4:54pm UTC](https://discuss.python.org/t/modulenotfounderror-no-module-named-pil/19723 "2022-10-05T16:54:09Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![fixit7](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@fixit7](https://discuss.python.org/u/fixit7)\
**Post date:** [October 7, 2022, 9:47pm UTC](https://discuss.python.org/t/modulenotfounderror-no-module-named-pil/19723/18 "2022-10-07T21:47:18Z")

</div>

```auto
python3.6 -m pip install --upgrade pip

python3.6 -m pip install --upgrade Pillow 

#! /usr/bin/python3.6

# Use python3.6 [name of python script]
# Much help from ironfoot and karel
 
import os
import sys
from PIL import Image
 
if len(sys.argv) > 1:
    if os.path.exists(sys.argv[1]):
        im = Image.open(sys.argv[1])
        target_name = sys.argv[1] + ".jpg"
        rgb_im = im.convert('RGB')
        rgb_im.save(target_name)
        print("Saved as " + target_name)
    else:
        print(sys.argv[1] + " not found")
else:
    print("Usage: convert2jpg.py <file>")
    

```

---

_[View the full topic](https://discuss.python.org/t/modulenotfounderror-no-module-named-pil/19723)._
