why PIL is not installing in python version 3.9.7 - python

I have facing the issue I could not import PIL in VS code.but in jupyter notebook it is imported.my python version is python 3.9.7 ,i have tried many commands to install but its not work.it keep saying like no module named as PIL .and also I couldnot import requests also in vs code.I used these commands
pip install PIL
pip install Pillow
but it didnot work

Related

How to import OpenCV into python

I have downloaded Anaconda on my Windows PC, and I have been using Spyder IDE. Now I want to do a project with OpenCV.
However, I have tried to install OpenCV using the Command Prompt and typing the following in:
pip install opencv-python
This only gives an error message and says "pip" is not recognized as a command.
Furthermore I tried to import OpenCV into Python using the following:
import cv2
This also doesn't work
I would appreciate any help in getting OpenCV working.
It depends on Your OS. Check Your pip installation with cmd: pip -V and check python with: python -V
It seems like You don't have pip installed at all.
Than import cv2 should work.

Pillow is installed but still getting an error

I have pillow installed and I have followed multiple answers however, when i try to run my program it says "ModuleNotFoundError: No module named 'Pillow'
I have already downloaded pillow through GIT Bash by following instructions from answers on how to and I have already tried replacing the 'pillow' for 'PIL' but i get the same error.
My code:
from Pillow import ImageTk,Image
EDIT: I am using version 3.6.5 of Python
Unfortunately I don't have enough reputation to comment on your post.
First, try these import statements:
import PIL
# OR
from PIL import *
I just want to ask you to make sure that PIL is correctly installed. Run the following python code as a single-line python file. This will print out a list of python modules installed.
help('modules')
See if PIL or Pillow on the list. If not, then PIL is not correctly installed.
I was also just wondering if you can use pip (python's package manager) to re-install Pillow. Since you're using python 3.6.5, pip is pre-installed. If you don't mind using pip, execute the following command in CMD on Windows or Terminal on a Mac to install PIL with pip:
python -m pip install pillow
Try again with your original import statements with PIL and Pillow. If none of these works, try the following import statements, again:
import PIL
# OR
from PIL import *
How this helps.

Python Import Error, Symbol not found: _iconv Referenced from:

I've successfully running Python 2.7.15 (default one) on macOS Sierra 10.12.6.
I have also installed OpenCV using pip of version 3.4.0, using this tutorial.
Screenshot: Python IDLE Screenshot showing OpenCV version on macOS
When I try to import cv2 from python IDLE it gets successfully imported, but when I try import cv2 from a python script and run as cgi script, it shows the following error:
Error Screenshot: OpenCV import error while importing and running from browser
What does the error actually mean?
How can I solve this?
Note: I've no errors while running python as CGI scripts (without importing opencv).
Note: I've even tried of installing OpenCV using Homebrew but it still produces the same error while importing OpenCV as a CGI script.
Very common error with OpenCV, the best move you can do is to install OpenCV using Anaconda.
I recommend you to fully uninstall Python and install Anaconda Python, it comes with the conda package manager that will allow you to install opencv--python easily.
https://www.anaconda.com/download/
Once Anaconda Python is installed, try the following commands:
conda install -c conda-forge opencv
conda install -c menpo opencv3

Install PIL/Pillow for ubuntu python 2.7

I have successfully installed PIL/Pillow for python 3.4 but I want it for python 2.7. I thought it might be automatically downloaded for 2.7 as well but when I tried the python shell from the terminal, it keeps saying No module named PIL and No module named PILLOW. What can I do? When I try all the installation commands as given in other answers, it says:
Requirement already satisfied (use --upgrade to upgrade): pillow in ./.local/lib/python3.4/site-packages
My problem is the opposite of this
Install PIL using pip install pillow
Then in the shell try import PIL or from PIL import ...
In python 2.7 there is no module named PIL,
you can use PIL features through Pillow,so PIL aka Pillow
Your output shows you are still using python3
Switch to python 2.7 and try pip install pillow
Then you can directly import PIL and use its methods completely

How to install packages in Python 3? - PIL on eclipse python33 beginner

I am very new in using python
how to install PIL on eclipse am using python 33
in my code I see this error
from PIL include Image
Error : no module named PIL
I have tried
import Image
no errors at the import part on eclipse but there is an error on
Image.open(image_stream)
Error: Undefined variable from import: open PyDev breakpoint
when I run from command window
no module named Image
The file site-packages is empty I don't know how to include packages
Your question should be
How to install packages in Python 3?
go to https://www.python.org/downloads/ and download Python 3.4 or newer. (This has the pip command to install packages)
install it.
open a console
type
pip3.4 install pillow
if this does not work then use the full path (example for windows):
C:\Python34\Scripts\pip3.4 install pillow
the import statement should work now
import PIL
If you search for this you can find many answers: https://stackoverflow.com/search?q=python+install+PIL

Categories

Resources