Problem importing modules in Visual Studio Code - python

I am working on python using the editor Visual Studio Code. The problem is that there are certain packages that are already installed on my MAC but the Visual Studio Code shows an error when I try importing the packages to my code. Few packages that show this error are: Pillow, pyserial, bs4,etc. I have downloaded the packages using the following pip command:
sudo pip install Pillow
The packages are shown on my system when I use the command:
pip freeze

Related

Setup.py error when installing dlib on Windows 10 [PYTHON]

Whenever I try to install dlib using pip install dlib or pip3 install dlib, I get the following error message error
I have already downloaded cmake and cv2, and I have also added cmake bin to the environment variables, I am not sure what else I could do to get this working. My main point downloading dlib is to be able to use the face_recognition library.
Follow the article on the https://www.geeksforgeeks.org/how-to-install-dlib-library-for-python-in-windows-10/
Install CMake from its official website and make sure choose the right version according to your system configuration.
While installing CMake select Add CMake to the system PATH to avoid any error in the next steps.
Install the c++ compiler of the visual studio code community version.
Install cmake library pip install cmake.
Install dlib library pip install dlib.

Unable to install dlib module

While installing dlib module, all the subprocesses are killed and showing that legacy error.
The same error is faced when face-recognition is installed.
I tried to do this with github repositry files.But also it is not working for both of the module.
I want to know how to install successfully both the modules in python 3.11.1 version on windows 10 laptop
From https://www.geeksforgeeks.org/how-to-install-dlib-library-for-python-in-windows-10/ :
Install Cmake from https://cmake.org/download/ (Add to PATH)
Install the c++ compiler of the visual studio code community version. For that go to the visual studio code official website https://visualstudio.microsoft.com/visual-cpp-build-tools/
Then pip install cmake and dlib

Did pip3 install psycopg2, but can't import into visual studio code

I was able to run pip3 install psycopg2, and it returns saying its installed.
I was also able to run pip install psycopg2-binary and it says its installed.
Yet when I try to run import psycopg2 in my .py files on visual studio code it says for module found named psycopg2. Furthermore, when I run python in terminal and run import psycopg2 it says there is no module found by that name. I am using apple m1 chip so im not quite sure whether I installed it incorrectly or if psycopg2 is still unavailable on mac m1. Any help would be most appreciated.

How to resolve import error in visual studio code in window 8?

When I try to import pygame in visual studio code, it shows me error
The following error is shown by visual studio code:
mod= importlib.util.module_from_spec(spec)
Import error :DLL load failed while importing pywintypes : the
specified procedures could not be found
For windows, if you need to upgrade pip
python -m pip install --upgrade pip
Install pypywin32 package
python -m pip install pypiwin32
Please try
pip3 install pypiwin32
Pywintypes is part of the Python for Windows extensions, otherwise known as pywin32. You'll need to install that to get access to Pywintypes.

Can't pip install virtualenv on Windows 10 for Python, version doesn't satisfy, no matching distribution

When attempting to install the virtualenv package I get the following error:
C:\Users\user>pip install virtualenv
ERROR: Could not find a version that satisfies the requirement virtualenv (from versions: none)
ERROR: No matching distribution found for virtualenv
I'm using a basic user profile (not admin) on Windows 10, Python 3.8.2, pip 20.0.2, and the basic command prompt shell.
I don't know if this will help future searchers, but the pip install worked after I finished modifying and repairing Visual Studio Community and Visual Studio Build Tools.
I had them modifying from the Visual Studio Installer in the background, removing unnecessary packages. Meanwhile, I ran the above virtualenv installation and got the error. After the VS modifications were complete, I ran repairs on both from the VS Installer because they hit some hiccups. Then, I tried pip install virtualenv again from the command prompt, and it worked.
I'm not sure why, but I think either the VS modify processes themselves were interrupting the pip install, or there were VS errors that needed to be repaired before virtualenv could install.

Categories