I have the anaconda distribution with python version 2.7. I tried several commands such as sudo and pip but nothing seems to work. I am told in the shell that the installation is complete but every time i try to send in the console "import MySQLdb" i get the following error:
Traceback (most recent call last):
File "", line 1, in
import MySQLdb
File "build/bdist.macosx-10.5-x86_64/egg/MySQLdb/init.py", line 19, in
File "build/bdist.macosx-10.5-x86_64/egg/_mysql.py", line 7, in
File "build/bdist.macosx-10.5-x86_64/egg/_mysql.py", line 6, in bootstrap
ImportError: dlopen(/Users/andreasportelli/.python-eggs/MySQL_python-1.2.5-py2.7-macosx-10.5-x86_64.egg-tmp/_mysql.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: /Users/andreasportelli/.python-eggs/MySQL_python-1.2.5-py2.7-macosx-10.5-x86_64.egg-tmp/_mysql.so
Reason: image not found
What should I do to install it?
Consider using pymysql
You can install it by
conda install pymysql
FYI What is PyMySQL and how does it differ from MySQLdb? Can it affect Django deployment?
Related
I ran into problems when I installed Python 3.5 on Mac. I wanted to use Python 3.5 as the interpreter when I ran my Django development server. I got this issue when I tried it (I know I must install a virtualenv, read below):
$ python3 manage.py runserver
Traceback (most recent call last):
File "manage.py", line 7, in <module>
from mezzanine.utils.conf import real_project_name
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/Mezzanine-4.0.1-py3.5.egg/mezzanine/utils/conf.py", line 7, in <module>
from django.conf import global_settings as defaults
ImportError: No module named 'django'
The first was when I tried installing pip packages it installed by default on the Python 2.7 in my virtual environment:
pip install django==1.9rc2
Collecting django==1.9rc2
Downloading Django-1.9rc2-py2.py3-none-any.whl (6.4MB)
100% |████████████████████████████████| 6.4MB 66kB/s
Installing collected packages: django
Successfully installed django-1.9rc2
I use Django so I tried also install a virtual environment for the first time. First I tried it with pip, but that didn't work.
So how do I setup so that my Python3.5 is the default usage when using Python interpreter and in my virtual environment? I can't figure this out or I have done something wrong in my process.
Edit:
Thanks for the answer and comment. I tried with the both solutions and the same error persisted. See output below:
$ virtualenv -p /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 Django/
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/virtualenv.py", line 14, in <module>
import shutil
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/shutil.py", line 10, in <module>
import fnmatch
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/fnmatch.py", line 15, in <module>
import functools
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/functools.py", line 21, in <module>
from collections import namedtuple
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/collections/__init__.py", line 16, in <module>
from reprlib import recursive_repr as _recursive_repr
File "/Library/Python/2.7/site-packages/reprlib/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
My virtualenv version: 13.1.2
Your error is related to a known virtualenv bug regarding python-future and mixing up the 2.7 and 3.x module paths, the solution is to downgrade virtualenv to a version < 12.04, 12.0.2 is suggested in the link.
Firstly, If you are going to use multiple versions of python,then you must use Virtual Env.Also then Create your virtualenv using the following command so that it uses python 3.5 as default environment :
virtualenv -p python3 envname
and then install django in the virtualenv.after activating your virtualenv
Followed instructions on the github page. Of course, had to make minor changes since I was working with a windows 7 system. I got to the point post creating the virtual environment for portia to run. And I was trying to install the required packages using pip.
pip install -r requirements.txt
It failed with a log.
Now in the shell I try to run twistd, it gives error saying command not found. I even tried as follows:
deostroll#DEOTOP /c/Portia/portia/slyd (master)
$ python ../../portia_env/Scripts/twistd.py -n slyd
Traceback (most recent call last):
File "../../portia_env/Scripts/twistd.py", line 13, in <module>
from twisted.scripts.twistd import run
File "c:\Portia\portia_env\lib\site-packages\twisted\__init__.py", line 53, in
<module>
_checkRequirements()
File "c:\Portia\portia_env\lib\site-packages\twisted\__init__.py", line 37, in
_checkRequirements
raise ImportError(required + ": no module named zope.interface.")
ImportError: Twisted requires zope.interface 3.6.0 or later: no module named zop
e.interface.
(portia_env)
deostroll#DEOTOP /c/Portia/portia/slyd (master)
$
Is there an alternate procedure to follow in order to make this work on windows?
It looks like zope.interface didn't install when you ran:
pip install -r requirements.txt
Could you try running the following and see if it works?
pip install zope.interface
Here is my problem:
After I managed to install anaconda (having python 3.4), I apparently managed to install pybrain too. But when i use 'import pybrain' from anaconda or from the terminal too I get this error:
>>> import pybrain
Traceback (most recent call last):
File "<ipython-input-2-0fb7233d2a8c>", line 1, in <module>
import pybrain
File "//anaconda/lib/python3.4/site-packages/PyBrain-0.3-py3.4.egg/pybrain/__init__.py", line 1, in <module>
from structure.__init__ import *
ImportError: No module named 'structure'
Simply running sudo pip3 install git+https://github.com/pybrain/pybrain.git worked for me after having the same issue.
The version up on PyPi isn't Python 3 compatible.
Installing the latest commit directly using pip3 should take care of your old package (from PyPi) as well.
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
Trying to get my feet wet with PySide development but having trouble
getting setup. I tried installing the binaries 1.0.4-r1 and 1.0.5 but
both of those produced the following message on import PySide
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/__init__.py", line 2,
in <module>
import private
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2,
in <module>
from QtCore import __moduleShutdown
ImportError: dlopen(/Library/Python/2.6/site-packages/PySide/
QtCore.so, 2): Library not loaded: QtCore.framework/Versions/4/QtCore
Referenced from: /Library/Python/2.6/site-packages/PySide/QtCore.so
Reason: image not found
Then I tried doing the install from the gitorious build scripts. Using
sudo ./dependencies.osx.sh. After that completed I now get the
following error on import PySide.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/__init__.py", line 2,
in <module>
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2,
in <module>
ImportError: No module named QtCore
Any advice is appreciated. I'm using QtCreator 2.2.1 and Qt SDK
1.1.2 / Qt Library 4.7.3. Thank you!
Try to install latest version MacPorts and python 2.7 first and set python2.7 as default python version:
sudo port install python27
port select --list python
sudo port select --set python python27
then re-install PySide again:
sudo port install py27-pyside
I just encountered exactly the same problem:
Library not loaded: QtCore.framework/Versions/4/QtCore
You need to find installed QT libraries and make them visible to the dynamic linker.
My Qt*.framework folders live in /usr/local/lib (Qt is installed with Homebrew package manager). So, I added
export DYLD_FRAMEWORK_PATH=/usr/local/lib:$DYLD_FRAMEWORK_PATH
to ~/.bash_profile and restarted the console.
That's it.
I just solved the same problem by using homebrew to install pyside.
$ sudo -H pip uninstall pyside
$ brew install pyside