Where is PIL installed? TideSDK python - python

I am using Tidesdk and windows7.
PIL was installed in python shown below.
C:\ProgramData\TideSDK\modules\win32\python
It works in the examination using TideSDK Developer.
If it packs, it stops however, working.
PIL is not installed if packed python is looked at.
If PIL is installed where, does it come to work?

Related

Pycharm can't recognise moduls I just installed

I need to code a quick script for facial recognition. I imported the following modules (as seen in the picture below)
But pycharm says that there are no modules named face_recognition, cv2, unsolved reference path and imutils.
I don't know what the issue might be since I am super sure I installed opencv and face recognition on my laptop.
Thanks.
For example, I checked my current cv2 version and the result was this
import cv2
cv2. version
'4.7.0'

PyCharm Isn't Autocompleting OpenCV [duplicate]

I cannot get autocomplete working for OpenCV (Python) on Windows.
According to Abid's instructions here, I pasted the cv2.pyd file in the C:\Python27\Lib\site-packages.
In the Python code, I import as follows:
import cv2.cv as cv
I have also installed numpy, and it created its own folder in site-packages unlike OpenCV (which I've pasted directly into site-packages).
With this setup, the code executes without any problems, even when OpenCV methods are called.
But I have not been able to get autocomplete to work. I have tried to get it to work on Sublime Text 2 (with SublimeCodeIntel) and PyCharm. In both IDEs, autocomplete works for the numpy import, but fails for the OpenCV import.
I'm using OpenCV 2.4.6, and Python 2.7 (32 bit).
Any possible solutions?
The reason it's not working is because you're using a .pyd file, which is essentially the same as a compiled .dll. Autocomplete works by reading the source .py files, which are plain text. Try installing the OpenCV and Intel Math Kernel Library optimized NumPy packages from Christoph Gohlke's Python Extension Packages for Windows repository, which is frequently updated and a must-use resource for anyone who does any kind of scientific Python computing on Windows. Make sure you delete the cv2.pyd and numpy directories from site-packages first. These new packages will install the .py source files needed by the autocomplete engine in Sublime Text.
EDIT
OK, so I wrote the above because it worked well for a bunch of other packages. I'm a Python 3 guy, and I never installed OpenCV from Gohlke because it only has Python 2 bindings. After reading #CrazyCoder's comment below, I booted up Win7, and indeed he's absolutely correct (and I should have realized this before) - since OpenCV is written in C/C++, the only .py file included in the Gohlke package is cv.py, whose entire contents are as follows:
from cv2.cv import *
The rest is contained in cv2.pyd and a bunch of .dlls. The full OpenCV Windows distribution from opencv.org is a 291 MB download, which expands to 3 GB, and the few .py files in there are involved in building OpenCV, and aren't any good for autocomplete purposes. So, unfortunately, I don't know if there's a solution to your problem at the moment. Just keep the docs handy, and perhaps check out OpenCV Computer Vision with Python from Packt/O'Reilly, published in April 2013.
I've had the same issue with PyCharm when building a custom version of OpenCV on windows. Here is what I did to fix it:
OpenCV made a folder in Python site-packages like so:
opencv site-packages
So what you need to do is just add the python-3.9 folder to your interpreter.
File
Settings...
Python interpreter
Three dots icon next to your interpreter -> Show all...
Select your interpreter and click on the "Show paths for selected interpreter" icon
Add the folder inside the cv2 site-packages
Now import the cv2 module normally.
The best way to solve all the problems of OPENCV-PYTHON is by uninstalling it and reinstalling it.
Even I faced the same problem.
I fixed it by:
python -m pip uninstall Opencv-python
Then I reinstalled it by using a lower version. But unfortunately, I did not know the versions of opencv; So by using a small trick you can get it by running:
python -m pip install opencv-python==
and you will get an error similar to this:
ERROR: Could not find a version that satisfies the requirement opencv-python== (from versions: 3.4.0.14, 3.4.10.37, 3.4.11.39, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.15.55, 3.4.16.57, 3.4.16.59, 3.4.17.61, 3.4.17.63, 4.3.0.38, 4.4.0.40, 4.4.0.42, 4.4.0.44, 4.4.0.46, 4.5.1.48, 4.5.3.56, 4.5.4.58, 4.5.4.60, 4.5.5.62, 4.5.5.64) ERROR: No matching distribution found for opencv-python==
Here you can see all the versions of opencv-python; choose any one (but not the latest as the error occurs due the latest version of opencv-python. install it by using:
pip install opencv-python==3.4.17.61 (You can choose your version, but this version solved the issue for me)
then enjoy your coding....
Even AUTO-COMPLETE error in opencv-python gets solved.
HAPPY CODING

Raspberry Pi 3: OpenCV 3.4.0 missing some files after installation and can't be called within my code

I hope you're doing good.
I've been working on a robot for couple of months and got it working properly recently.
Sadly, my code got deleted including all libraries, tried to install OpenCV couple of times but I'm still getting errors
I used this link to install OpenCV 3.4.0 with the latest version of Raspbian https://www.life2coding.com/install-opencv-3-4-0-python-3-raspberry-pi-3/
ImportError: libavcodec.so.56: cannot open shared object file: No such
file or directory
Is there a proper way to install all libraries ? I'll include all libraries I used at the beginning of the code below.
Thanks in advance
[import cv2
import cv2.cv as cv
import numpy as np
from gopigo import *
import sys
import RPi.GPIO as GPIO
import time
import os
import multiprocessing as mp
Could be that you installed an old/wrong version of opencv, or it could be that you installed the base version, without the extra modules.
I would advice installing use pip, always works for me. In that case the following command should be enough:
pip install opencv-contrib-python
Note: you need to uninstall openCV first. Read more about the installation here
If you dont know what pip is, read about it and install from here
I was using 'Raspbian Stretch Lite' but didn't work, I might have missed something up while installing OpenCV library
I tried latest version of 'Raspbian Stretch with desktop and recommended software' from Raspberrypi's website https://www.raspberrypi.org/downloads/raspbian/
and followed all steps stated here to install OpenCV https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/
Once done with OpenCV use this command within your code to relocate packages
import sys
sys.path.append('/usr/local/lib/python2.7/site-packages')
OpenCV is working fine to me now. Thanks to J.D. and Jayjayyy for guiding me and helping me to solve this issue, I really appreciate your help :)

cannot find reference for opencv functions in pycharm

I have opencv-python installed and the .pyd file is added in the site-packages and the DLLs. The code works with images. When I want to read, show, write an image it works. But I get a warning that the functions' references cannot be found in init.py . Due to this, I can not use the auto-complete feature. Could someone help me out? I am using opencv 3.4.0 and python 3.6.4 in pycharm. I downloaded opencv via pip in the command prompt.
The problem is caused by CV2 and how __init__.py does the imports. Just ignore the warnings the program will work all the same, or you can do an import with an alias like:
import cv2.cv2 as cv2
If you have a warning on it press Alt+Enter to install and fix it. Now you will have the code completion and no other warnings (about that) on the project.
Switching to an older version of opencv solved this problem for me.
Apparently pycharm sometime breaks depending on the version of opencv. For me, the newest version was, 4.6.X unstalling and installing 4.5.X did the trick.
I use python 3.10 and my newest version for opencv is 4.6.0.66 ,by changing opencv version to 4.5.5.62 and with an alias: import cv2.cv2 as cv2 my problem has solved.
Import cv2 as follows:
from cv2 import cv2
I installed version 4.5.5.64 and imported with an alias.
import cv2.cv2 as cvv2
I was using Python 3.10.2288.0 and OpenCV 1.6.0.66.
I resolved the issue by rolling back the OpenCV version to 4.5.5.62.

How can I use PIL with Netbeans 6.8 (Python version 2.6.5)

I have installed Python Imaging Library (PIL) version 1.1.7 on a Windows 7 computer. I have configured Netbeans to use Python (instead of Jython). I added a reference to C:\Python26\Lib\site-packages\PIL to the project but when I attempt this code:
import Image, ImageDraw
img = Image.new("RGB", (100,150),(255,255,255))
I get the following error:
ImportError: The _imaging C module is not installed
The _imaging.pyd file exists and is in the right directory. Furthermore, Python (from the command line) can load PIL and Image and execute the code that I posted above successfully. Can anyone enlighten me as to what I am doing wrong? Thank you!
Solved. Project was incorrectly using Jython instead of Python. Although I configured Python as the default Python instance in the main Netbeans settings, that change didn't propagate to my project. Setting it in the projects properties fixed it. Jython is known to have issues with PIL.

Categories

Resources