How to fix Python ImportError: No module named cv2 apt get install python-opencv pip install opencv-python. Had the same issue and resolved it with: sudo pip install -upgrade psutil.
I'm very new to Ubuntu/Linux and Python so it's entirely possible I'm missing something obvious here. I'm running Ubuntu 16.04 LTS, server version.I've just installed the official MySQL connector/python (2.1.7, python3 version) using dpkg -i package-name.deb (obviously I replaced package-name with the actual name).
![]()
It's listed as being compatible with Python 3.5, which is the version I have. When I try to verify the installation through the Python interpreter using import mysql.connector, I just get the following error: import mysql.connectorTraceback (most recent call last):File ', line 1, in ImportError: No module named 'mysql'On one similar question, I've seen it suggested that the connector may not have installed properly if python is not in the path. I didn't seem to get any issues during the installation; the file python3 is in /usr/bin which is definitely in the path, but seems to be a link to the file python3.5 in the same location. Running the command which python3 gives the output usr/bin/python3 but running which python gives no output.The package apparently also contained a C library, which seems to have installed in usr/lib/python3/dist-packages. Nothing else in that directory is called anything related to MySQL.What should I be looking for to know whether it's an issue with the connector installation or with Python itself?
And how do I fix this? The solution is to install corresponding Python 3 module: sudo apt-get install python3-mysql.connectorIt fixes import mysql.connector error: $ python3Python 3.5.2 (default, Nov 23 2017, 16:37:01)GCC 5.4.0 20160609 on linuxType 'help', 'copyright', 'credits' or 'license' for more information. import mysql.connectorAnd similar for Python 2: sudo apt-get install python-mysql.connector$ python2Python 2.7.12 (default, Dec 4 2017, 14:50:18)GCC 5.4.0 20160609 on linux2Type 'help', 'copyright', 'credits' or 'license' for more information.
import mysql.connector.
![]()
I recently cloned a Django project of mine in a brand new machine, and went about setting up its dependencies. One such dependency was azure storages, for which I followed the advice and simply did sudo pip install azure.However, upon `python manage.py syncdb', I keep getting the error:ImportError: No module named azure.storage.blobI've tried to solely do sudo pip install azure-storage as well, but this doesn't alleviate my problem either.
This shouldn't have been this problematic. What do I do? As I know, this issue is due to the version of azure storage client library for python.The old version has only one blobservice.py file andthe newest splits it into three files such as blockblobservice.py, pageblobservice.py and appendblobservice.py. So, if you want to use BlockBlobService, you could install azure-storage 0.33.0.The following steps help you to install azure-storage 0.33.0.1.You could check the version using pip: #pip freeze2.If you see azure0.11.0 (or any version below 1.0), uninstall it first: #pip uninstall azure3.Install azure-storage 0.33.0 #pip install -upgrade azure-storageYou may encounter some error about cryptography, you could run the following command to solve it.#yum install gcc libffi-devel python-devel openssl-devel#pip install cryptographyThe references:Hope it helps. Any concerns, please feel free to let me know.
Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |