티스토리 뷰
Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.
Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.
아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.

How to use MySQLdb with Python and Django in OSX 10.6?
OSX 10.6에서 파이썬 및 장고와 함께 MySQLdb를 사용하는 방법은?
문제 내용
This is a much discussed issue for OSX 10.6 users, but I haven't been able to find a solution that works. Here's my setup:
이것은 OSX 10.6 사용자들에게 많이 논의되는 문제이지만, 나는 효과적인 해결책을 찾지 못했다. 제 설정은 이렇습니다.
Python 2.6.1 64bit Django 1.2.1 MySQL 5.1.47 osx10.6 64bit
Python 2.6.1 64비트 장고 1.2.1 MySQL 5.1.47 osx10.6 64비트
I create a virtualenvwrapper with --no-site-packages, then installed Django. When I activate the virtualenv and run python manage.py syncdb, I get this error:
저는 --no-site-packages로 virtualenvwrapper를 만든 다음, Django를 설치합니다. virtualenv를 활성화하고 python manage.py syncdb를 실행할 때 다음 오류가 발생합니다.
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/__init__.py", line 257, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 7, in <module>
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/sql.py", line 5, in <module>
from django.contrib.contenttypes import generic
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/contrib/contenttypes/generic.py", line 6, in <module>
from django.db import connection
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/db/__init__.py", line 75, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/db/utils.py", line 91, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/db/utils.py", line 32, in load_backend
return import_module('.base', backend_name)
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
I've also installed the MySQL for Python adapter, but to no avail (maybe I installed it improperly?).
MySQL for Python 어댑터도 설치했지만 소용이 없었습니다(잘못 설치했나요?).
Anyone dealt with this before?
전에 이 일을 처리한 사람이 있나요?
높은 점수를 받은 Solution
I had the same error and pip install MySQL-python
solved it for me.
나도 같은 오류가 있었고 pip install MySQL-python이 해결해줬다.
Alternate installs:
대체 설치:
- If you don't have pip,
easy_install MySQL-python
should work. - If your python is managed by a packaging system, you might have to use that system (e.g.
sudo apt-get install ...
)
만약 당신이 pip이 없다면, easy_install MySQL-python이 작동할 것이다.
python이 패키징 시스템에 의해 관리되는 경우 다음을 사용해야 할 수 있습니다. 해당 시스템(예: sudo apt-get install...)
Below, Soli notes that if you receive the following error:
아래에서 Soli는 다음 오류가 발생할 경우 다음과 같이 기록합니다.
EnvironmentError: mysql_config not found
환경 오류: mysql_config를 찾을 수 없습니다.
... then you have a further system dependency issue. Solving this will vary from system to system, but for Debian-derived systems:
... 시스템 종속성 문제가 추가로 발생합니다. 이를 해결하는 방법은 시스템마다 다르지만 데비안에서 파생된 시스템의 경우 다음과 같다.
sudo apt-get install python-mysqldb
가장 최근 달린 Solution
You can install as pip install mysqlclient
aspip install mysqlclient를 설치할 수 있습니다.
출처 : https://stackoverflow.com/questions/2952187/how-to-use-mysqldb-with-python-and-django-in-osx-10-6
'개발 > 파이썬' 카테고리의 다른 글
모듈을 가져올 때 파이썬에서 모듈을 실행하는 이유는 무엇이며, 어떻게 중지합니까? (0) | 2022.11.27 |
---|---|
파이썬을 사용하여 cURL 명령을 실행하는 방법은? (0) | 2022.11.27 |
ImportError: libGL.so.1: 공유 개체 파일을 열 수 없습니다. 해당 파일 또는 디렉토리가 없습니다. (0) | 2022.11.27 |
오류 발생 시 Python 디버거를 자동으로 시작하기 (0) | 2022.11.27 |
clang error: unknown argument: '-mno-session-madd'(패키지 설치 실패) (0) | 2022.11.27 |