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
Related
I tried to instlall Python3-pip on my Linux Debian 8 Server with following command: sudo apt install python3-pip. That worked fine without any problem.
But if I'm checking now the Version of this pip3 module, I get follwing error:
$ pip3 --version
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip._internal.cli.main import main
File "/usr/local/lib/python3.4/dist-packages/pip/__init__.py", line 1, in <module>
from typing import List, Optional
ImportError: cannot import name 'List'
I tried to somehow solve this problem, but did not get any solution up to now...
Does anybody have had a similar Problem?
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.
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
I am running EPD python 2.7.3. I have installed psycopg2 by easy_install . But When i try to import the psycopg2, It shows the following error:
>>>import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
Referenced from: /Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/psycopg2/_psycopg.so
Expected in: dynamic lookup
I am runnin mac osx Mountain lion. Any suggestion?
it should work, i installed with $ sudo apt-get command on Ubuntu. everything work fine. may try to uninstall the postgresql and reinstall it.
I created a virtualbox with a fresh install of ubuntu 9.10.
I am trying to get MySQLdb to run on python but I'm failing at the import MySQLdb
I first tried sudo easy_install MySQL_python-1.2.3c1-py2.6-linux-i686.egg and then sudo apt-get install python-mysqldb.
Both apparently installed ok, but gave me the following error message when in python I have the import line:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/MySQLdb/__init__.py", line 19, in <module>
File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/_mysql.py", line 7, in <module>
File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/_mysql.py", line 6, in __bootstrap__
ImportError: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory
I have already installed MySQL and it is running, if that matters at all.
I tried following this, but failed in step 2
Your MySQLdb egg installation looks like it is not working properly. You should go into /usr/local/lib/python2.6/dist-packages and remove it.
The Ubuntu python-mysqldb package should work fine. Unless you have a good reason, you should stick to your distribution's package manager when installing new software.