Python VScode cannot import pyodbc library - python-import

I am using VScode to run my python code.
I can pip install all my libraries without problem and also use them.
With the "Pyodbc" library I have a problem.
I can install it normally but when I want to import it I get this error:
Traceback (most recent call last):
File "/Users/marvin/Documents/Python Projects /VSCode/SQL_test.py", line 1, in <module>
import pyodbc
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyodbc.cpython-311-darwin.so, 0x0002): Library not loaded: /usr/local/opt/unixodbc/lib/libodbc.2.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyodbc.cpython-311-darwin.so
Reason: tried: '/usr/local/opt/unixodbc/lib/libodbc.2.dylib' (no such file), '/usr/lib/libodbc.2.dylib' (no such file)
Does somebody know this problem and could possibly help me?
Best,
Marvin
Importing the pyodbc library to connect with an azure sql database.

Related

i installed opencv-python getting import error

import cv2
ImportError Traceback (most recent call
last) in
----> 1 import cv2
~\Anaconda3\lib\site-packages\cv2__init__.py in
3 import sys
4
----> 5 from .cv2 import *
6 from .data import *
7
ImportError: DLL load failed: The specified module could not be found
Looks like you are using Anaconda. If so don't use pip as it can break your environment, use conda.
You can try by
first going to "anaconda-prompt" using windows search and then run the command as below:
conda install -c conda-forge opencv
or any other from https://anaconda.org/conda-forge/opencv.
Maybe you can uninstall and install opencv. This usually happens when you download package at a different file location or the package itself is not installed properly.
I suggest using this:
1.pip install opencv-python
or if you need the full module (cnn, face analysis, shape and etc)
2.pip install opencv-python-contrib

Importing torch failed when lazyimported cv2 first

I am using self-compiled python 3.6.3 (link) on Ubuntu 14.04. My torch is 1.0.1.post2, Tensorlayer 1.10.1. To reproduce my issue, try with
from tensorlayer.lazy_imports import LazyImport
cv2 = LazyImport("cv2")
import torch
It fails with,
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/torch/__init__.py", line 84, in <module>
from torch._C import *
ImportError: dlopen: cannot load any more object with static TLS
My torch is installed with pip install torch torchvision. Also before compiling Python, I did apt-get install tk8.6-dev in order to make python configured with tkinter. The reason why I compile Python on my own is that shipped apt-get install-ed Python is incompatible with tkinter somehow, even with packages installed, it errs at importing too.
I wish not to change the importing order at it surely works. I hope to find out the real cause of it. Many thanks in advance!

how to solve import error no module name cv in python?

i am running the python code but every time is showing
line 13,in
import cv2.cv as cv2
importerror: No module named cv
how to slove this problem,
i am using rPi 2 opencv-3.1.0 with python 2.7
If you have compiled opencv from source, link cv2.so from compiled directory to your python system directory (generally it is /usr/local/lib/python2.7/dist-packages/)
If not helpful, setup venv in your project directory and link cv2.so and cv.py from python system directory to your project directory.

Pyscripter - ImportError: DLL load failed: %1 is not a valid Win32 application

I am new to Pyscripter and found it interesting but getting the below error. lumberjack is an internal framework to work with.
>>> import lumberjack
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Perforce\svasudevan\HPro\lumberjack\__init__.py", line 1, in <module> import analysis
File "C:\Perforce\svasudevan\HPro\lumberjack\analysis.py", line 11, in <module> import scipy.signal
File "C:\Python27\lib\site-packages\scipy\signal\__init__.py", line 227, in <module> from . import sigtools
ImportError: DLL load failed: %1 is not a valid Win32 application.
I am sure that nothing wrong with the code above as I tried with Enthought Canopy and it works fine, since Pyscripter has more options to do with, I am using it but getting the above error.
FYI, all the modules like Numpy, Matplotlib, Scipy and Pyaudio has been imported successfully.
Could you please let me know the pre requisites to be done to correct this error. I think there is some problem with the env variables.
Thanks
Shobith
I'm guessing that the version of Python that PyScripter is running is different than the one you get in EPD/Canopy (Python is compiled C code, so the version matters). There's another question about controlling the version of Python used with PyScripter.
I solved this problem, not exactly like yours but with a similar error, but going to the Run menu, then Python engine, then switching to remote from internal. I had noticed that I could import the module in IDLE but not PyScripter.

Httplib2 module installation on window7 64

In Python, I used the easy_install and tried to install oauth2. Then I found it needs httplib2.
Used: easy_install httplib2 in the command prompt.
and found the httplib2 0.7.6 egg in site-packages directory.
But when I do
import httplib2
it came back with this: ImportError: No module named httplib2
The only way I can make 'import httplib2' work is first run the setup file in the httplib2 package in the shell and then 'import oauth2'.
I don't know what to do with this, because I need oauth2 to connect to Yelp API. Please help me with this, thank you sooooooooooooo much!!!

Resources