Why is my psycopg2 not working with python3? - python

I am trying to run a simple python script to connect to my local postgresl db. I am on a mac and after doing a pip install psycopg2 and pip install psycopg2-binary I still get a module not found error in my simple script.
Python 3.8.1
Error:
Traceback (most recent call last):
File "test.py", line 1, in <module>
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'
test.py:
import psycopg2

Related

Issue with mysql connector [duplicate]

I'm getting below error while trying to run the linux image container on windows 10 in docker desktop.
Traceback (most recent call last):
File "app1.py", line 17, in <module>
import mysql.connector
File "/usr/local/lib/python3.8/site-packages/mysql/connector/__init__.py", line 35, in <module>
__version__ = _version.version
AttributeError: module '_version' has no attribute 'version'
I had the same problem on Ubuntu 16.04 using python3.5 with the package mysql_connector_repackaged installed via pip.
I solved by removing it and installing the package mysql-connector-python
pip3 install mysql-connector-python

ModuleNotFoundError: No module named 'mysql' in windows powershell

I have successfully installed mysql-connector.I am running a python program "videos.py" in windows powershell.
But still I am getting the error saying :
Traceback (most recent call last):
File ".\videos.py", line 1, in <module>
from db import conn, update, select, insert
File "C:\wamp64\www\cvm\python\db.py", line 1, in <module>
import mysql.connector
ModuleNotFoundError: No module named 'mysql'
I have tried with
pip install mysql-connector-python-rf
pip install mysql-connector
pip list
and I see mysql-connector in the list
But yet there is the same error.

how can I import module if an installed one is incorrect?

I'm getting below error:
Traceback (most recent call last):
File "TicketGeneration_test.py", line 6, in <module>
from MysqlConnection import SQLConnection
File "/Users/ashish.kumar/MerchantRisk/June5th/reports/MysqlConnection.py", line 1, in <module>
import MySQLdb
ImportError: No module named MySQLdb
I've already tried :
pip install MySQL-python
pip install mysqlclient
My python version is Python 2.7.16

Can't install pyperclip python3 Mac?

I'm trying to run pyperclip module in PyCharm on Mac OS X. I've imported it and got a traceback error. I tried reinstalling it in terminal and it displayed collecting packages but I still get the error:
Traceback (most recent call last):
File "/Users/User/PycharmProjects/numberEmailRetractor/main.py", line 4, in <module>
import pyperclip, re
ImportError: No module named pyperclip

No module named Setup, import error

I'm trying to run through the Guestbook tutorial on the google appengine website. I have Python 2.7.13 and Python 3.6 installed. However when I'm trying to run the program locally via dev_appserver.py ./ command I'm getting this error.
Traceback (most recent call last):
File "C:\Users\sameer\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\dev_appserver.py", line 11, in <module>
import bootstrapping.bootstrapping as bootstrapping
File "C:\Users\sameer\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\bootstrapping.py", line 9, in <module>
import setup
ImportError: No module named 'setup'
I've tried installing and updating setuptools but it doesn't seem to work.

Categories