- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我看到这篇文章:Python mysqldb on Mac OSX 10.6 not working看到两个选项:
将 MySQL 客户端库添加到 LD_LIBRARY_PATH
mysql_config --libs-L/usr/local/mysql/lib -lmysqlclient -lpthread
所以我不需要在这里做任何事情。
成功安装 django 并运行 virtualenvs 环境并使用 sqlite3 创建项目。我想改用mysql来管理数据库。
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'blog', # Or path to database file if using sqlite3.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': 'root', # Not used with sqlite3.
'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
} }
这让我很吃力:表演之后:
sudo python manage.py runserver
我得到的错误是:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 209, in execute
translation.activate('en-us')
File "/Library/Python/2.6/site-packages/django/utils/translation/__init__.py", line 100, in activate
return _trans.activate(language)
File "/Library/Python/2.6/site-packages/django/utils/translation/trans_real.py", line 202, in activate
_active.value = translation(language)
File "/Library/Python/2.6/site-packages/django/utils/translation/trans_real.py", line 185, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/Library/Python/2.6/site-packages/django/utils/translation/trans_real.py", line 162, in _fetch
app = import_module(appname)
File "/Library/Python/2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/james/Projects/current/code/blog/jamesapps/../jamesapps/tagging/__init__.py", line 3, in <module>
from tagging.managers import ModelTaggedItemManager, TagDescriptor
File "/Users/james/Projects/current/code/blog/jamesapps/../jamesapps/apps/tagging/__init__.py", line 3, in <module>
from tagging.managers import ModelTaggedItemManager, TagDescriptor
File "/Users/james/Projects/current/code/blog/blog/django-tagging/tagging/managers.py", line 5, in <module>
File "/Library/Python/2.6/site-packages/django/contrib/contenttypes/models.py", line 1, in <module>
from django.db import models
File "/Library/Python/2.6/site-packages/django/db/__init__.py", line 78, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/Library/Python/2.6/site-packages/django/db/utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Python/2.6/site-packages/django/db/utils.py", line 33, in load_backend
return import_module('.base', backend_name)
File "/Library/Python/2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Library/Python/2.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: dlopen(/Library/Python/2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Python/2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg/_mysql.so
Reason: image not found
我的设置是:
Mac OS X 10.6.8 2x2Ghz Dual-Core Intel Xeon
/usr/local/mysql/bin/mysql: Mach-O 64-bit executable x86_64
/usr/bin/python (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/python (for architecture i386): Mach-O executable i386
/usr/bin/python (for architecture ppc7400): Mach-O executable ppc
~/.bash_profile 包含
export PATH=/usr/local/mysql/bin:$PATH
export EDITOR="$HOME/bin/mate -w"
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
如果我这样做
python shell
import MySQLdb
这什么都不显示。
我已阅读以下帖子和页面,包括更多内容:
<https://stackoverflow.com/questions/7335853/mysql-python-installation-problems-on-mac-os-x-lion>
<https://stackoverflow.com/questions/1299013/problem-using-mysqldb-symbol-not-found-mysql-affected-rows>
<http://friendlybit.com/tutorial/install-mysql-python-on-mac-os-x-leopard/>
我使用以下命令卸载了 mysql,然后从 .dmg 重新安装:
• Stop the database server
• sudo rm /usr/local/mysql
• sudo rm -rf /usr/local/mysql*
• sudo rm -rf /Library/StartupItems/MySQLCOM
• sudo rm -rf /Library/PreferencePanes/My*
• edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
• rm -rf ~/Library/PreferencePanes/My*
• sudo rm -rf /Library/Receipts/mysql*
• sudo rm -rf /Library/Receipts/MySQL*
• sudo rm -rf /private/var/db/receipts/*mysql*
使用 pip 卸载 mysql-python,然后从源代码重新编译:
sudo ARCHFLAGS='-arch x86_64' python setup.py build
sudo ARCHFLAGS='-arch x86_64' python setup.py install
我哪里出错了,是因为这个版本的 Mysql-python 的 mysql 客户端配置不正确吗?
最佳答案
sudo ln -s/usr/local/mysql/lib/libmysqlclient.18.dylib/usr/lib/libmysqlclient.18.dylib
关于mysql - Mac OS X 10.6、Mysql、Mysql-Python、Django,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8695360/
更新到 Xcode 12.2 后,由于与 Apple Silicon 相关的链接错误,我的项目开始无法编译。我似乎已经修复了大部分问题,但是一个构建静态链接框架的子项目给我带来了问题。然而,具有明显相
我有一台旧的 MacBook Pro,我在其中制作了两个应用程序并提交到应用程序商店。所以基本上签名身份在该机器的钥匙串(keychain)中。在 Mavericks 升级后,我不得不从那台计算机转移
我正在 MAC OSX 10.6 上编写一个示例应用程序,其 gcc 版本为 4.2。我正在使用 gcc 4.2 版编译应用程序。它在同一台机器上工作正常,但在 MAC OSX 10.5 (gcc 4
这是我的简单 mac 地址生成器: private String randomMACAddress(){ Random rand = new Random(); byte[] macA
我一直在寻找一种将十进制 MAC 地址转换为十六进制地址的方法。 例如 170.187.204.0.17.34至AA:BB:CC:00:11:22 . 致Convert HEX to Decimal
我想使用 UISceneSession 的委托(delegate)方法当用户将注意力从应用程序(窗口)移开,然后又回到应用程序(窗口)时,生命周期有助于通知我的 Mac Catalyst 应用程序。
我在签署 Mac 应用程序安装程序时遇到问题,我计划在 Mac 应用商店之外分发该应用程序。我正在使用开发人员安装程序证书来签署应用程序,但它给出了一些错误。下面是我用来签署应用程序的命令。 prod
Mac Catalyst 允许调整窗口大小,有没有办法为 Mac Catalyst 应用程序提供最小窗口大小? 最佳答案 只需将以下代码块添加到您的 application:didFinishLaun
这是一个非常理论性的问题,但对我来说很安静,即我如何进行下一步。 我正在开发一个SwiftUI MacOS应用程序,用户可以在其中上传自己的文件。元数据将存储在CoreData中,而我将文件手动存储在
滑动删除在 maccatalyst 中不起作用。相同的代码在 iPad 上运行良好。 在 maccatalyst 中未调用 UITableview trailingSwipeActionsConfig
我有两台 Mac,在进行 iPad 开发时,如果可以让另一台 Mac 启动模拟器并在构建完成后加载应用程序,我很感兴趣。 如果 iPad 应用程序在一台 Mac 屏幕和 Xcode 的模拟器中运行,所
我有一个用 objective-c 开发的 mac 应用程序。cpp 中还有另一个命令行中间应用程序,它是 native 主机应用程序,用于接收来自 chrome 扩展的消息。每当中间应用程序从扩展程
是否可以使用来自 Comodo 或 Thawte 的代码签名证书来签署应用程序并通过 Gatekeeper,或者我需要为此目的拥有 Mac 开发者订阅? 最佳答案 您必须是 Mac Developer
我正在使用 C++ 和 OpenGL/SDL 编写一个游戏,使用 Visual Studio 作为我的 IDE。我没有 Mac,甚至对这个平台都不熟悉。但我还是想发布给 Mac 用户。 我有三个问题。
我想将 MAC 地址 00163e2fbab7(存储为字符串)转换为其字符串表示形式 00:16:3e:2f:ba:b7。最简单的方法是什么? 最佳答案 使用一种完全迂回的方法来利用现有的一次将两个十
无法连接到Mac上的MySQL工作台。我收到以下错误:无法连接,服务器可能未运行。无法连接到‘127.0.0.1’上的MySQL服务器(61)如有帮助,将不胜感激。。谢谢!
我已经搜索了很长时间,似乎无法找到这个问题的答案。在 SO 上只找到两个问题/答案,但他们仍然没有回答这个问题 ( https://stackoverflow.com/search?q=netcore
我们在 Docker for Mac 中有一个 LoadBalancer 真是太酷了。 我对创建的端口有疑问: apiVersion: v1 kind: Service metadata: nam
我有一个我一直在从事的小型开源 OSX 项目,我想在 App Store 之外分发。 随着即将发布的 Mountain Lion,我想提供一个证书,以减少安装过程中的痛苦。 使用 App Store,
我的一台 Mac 没有互联网连接。我需要使用 docker pull。我的想法是,我将在我的一台具有互联网连接的 Mac 中使用 docker pull,然后将其复制到我没有互联网连接的 Mac。如何
我是一名优秀的程序员,十分优秀!