I've installed psycopg2 on ubuntu:
sudo apt-get install python-psycopg2
I also have python2.7 project. My version of psycopg2 is 2.4.5 which is compatible.
Version: 2.4.5-1build5
Provides: python2.7-psycopg2
But when I try to run the following command I get this error.
python manage.py syncdb
error:
raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 `module: No module named psycopg2`
My configuration in my pythonproject is right because it all worked on my local Windows. I don't know why it can't recognize or configure psycopg2.
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named psycopg2
Related
I am very new in Python as wel as in backend develpoment. I want to connect my python code with database so I installed mysql-connector-python using C:\Users\CCU-012\AppData\Local\Programs\Python\Python37\Scripts>python -m pip install mysql-connector-python but when I use import mysql.connector in my python code I am getting error Traceback (most recent call last):
File "C:/Users/CCU-012/PycharmProjects/array/demo_mysql_connection.py", line 1, in <module>
import mysql.connector
ModuleNotFoundError: No module named 'mysql'
You've installed the module globally, but your project is using a virtualenv (as evident from the "Python 3.7 (array)" text in PyCharm's status bar).
Install the module within the virtualenv; the easiest way to do that through PyCharm is to open the Python Console (4th tab at the bottom there) and
pip install mysql-connector-python
I'm trying to query my openldap server and got error
ModuleNotFoundError: No module named 'ldap'
I already tried to install python packages:
pip install python-ldap
pip install pyldap
pip install ldap(got alot of errors for this one)
And I'm still can't run it.
the code is:
import ldap
con = ldap.initialize('ldap://192.168.14.129')
con.simple_bind_s("cn=Manager,dc=afik,dc=com","xxxxx")
ldap_base = "dc=afik,dc=com"
query = "(uid=hr_user1)"
result = con.simple_bind_s(ldap_base, ldap.SCOP_SUBREE, query)
the error that I getting:
[root#localhost GitShared]# python openldap.py
Traceback (most recent call last):
File "openldap.py", line 1, in <module>
import ldap
ModuleNotFoundError: No module named 'ldap'
[root#localhost GitShared]#
I'm using python 3.6 on a centos 7 machine.
I am trying to import PyMySQl in idle, but I am getting this error:
Traceback (most recent call last):
File "pyshell#1", line 1, in <module>
import PyMySQL
ModuleNotFoundError: No module named 'PyMySQL'
I tried to install the package from CMD by using py -m pip install PyMySQL and it ended with "Successfully installed PyMySQL-0.8.1". Do I have to do install this PyMySQL anywhere else as to make it work in idle using import command?
root#kali:~# ./collecting_info_using_facets.py apache
Traceback (most recent call last):
File "./collecting_info_using_facets.py", line 3, in <module>
import shodan
ImportError: No module named shodan
I included path as #!usr/bin/env python but then also I cannot import shodan from the command line but I can run the same program from python3 IDLE.
It's because you need to download the Python module called 'Shodan'. You don't seem to have it installed, that's why Python is returning the error: ImportError: No module named shodan
You can install Shodan for Python3 via:
pip3 install shodan
Or if you're running Python2, try:
pip2.7 install shodan
Best of luck.
I "successfully" installed MySQLdb using:
pip install mysql-python
But when I use the terminal to check, "import MySQLdb" throws this error:
Traceback (most recent call last):
File "", line 1, in
File "//anaconda/lib/python2.7/site-packages/MySQLdb/init.py", line 19, in
import _mysql
ImportError: dlopen(//anaconda/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: //anaconda/lib/python2.7/site-packages/_mysql.so
Reason: image not found
I'm assuming this is due to some issue with linking, but I don't know what to do.
--- I'm on a Mac. ---
MYsql-python is a wrapper around MySQL client libraries. Here, you seem to lack SSL libraries. Try installing libssl (if you're on a Debian/Ubuntu/Mint)
sudo apt-get install libssl1.0.0