【问题标题】:pip install mysql==1.2.3 under virtualenv (Deploy Django to Amazon Elastic Beanstalk)virtualenv下pip install mysql==1.2.3(将Django部署到Amazon Elastic Beanstalk)
【发布时间】:2014-06-09 05:17:41
【问题描述】:

我正在尝试将 Django 部署到 mac Maverick 上的 Amazon Elastic Beanstalk,根据 official tutorial

我激活了一个virtualenv并pip install mysql==1.2.3后,出现如下错误:

(djangodev)Lee-Jamess-MacBook-Pro:~ h0925473$ pip install mysql-python==1.2.3
Downloading/unpacking mysql-python==1.2.3
  Downloading MySQL-python-1.2.3.tar.gz (70kB): 70kB downloaded
  Running setup.py (path:/private/tmp/djangodev/build/mysql-python/setup.py) egg_info for package mysql-python
    warning: no files found matching 'MANIFEST'
    warning: no files found matching 'ChangeLog'
    warning: no files found matching 'GPL'
Installing collected packages: mysql-python
  Running setup.py install for mysql-python
    building '_mysql' extension
    cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -arch x86_64 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/Cellar/mysql/5.6.17_1/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/temp.macosx-10.9-x86_64-2.6/_mysql.o -Os -g -fno-strict-aliasing
    clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
    clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
    error: command 'cc' failed with exit status 1
    Complete output from command /tmp/djangodev/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/djangodev/build/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/5_/vv2pw8nd0d53pjdqnrny5l080000gn/T/pip-yeU00T-record/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/djangodev/include/site/python2.6:
    running install

running build

running build_py

creating build

creating build/lib.macosx-10.9-x86_64-2.6

copying _mysql_exceptions.py -> build/lib.macosx-10.9-x86_64-2.6

creating build/lib.macosx-10.9-x86_64-2.6/MySQLdb

copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb

copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb

copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb

copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb

copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb

copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb

creating build/lib.macosx-10.9-x86_64-2.6/MySQLdb/constants

copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb/constants

copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb/constants

copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb/constants

copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb/constants

copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb/constants

copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb/constants

copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-2.6/MySQLdb/constants

running build_ext

building '_mysql' extension

creating build/temp.macosx-10.9-x86_64-2.6

cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -arch x86_64 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/Cellar/mysql/5.6.17_1/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/temp.macosx-10.9-x86_64-2.6/_mysql.o -Os -g -fno-strict-aliasing

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: command 'cc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /tmp/djangodev/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/djangodev/build/mysql python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/5_/vv2pw8nd0d53pjdqnrny5l080000gn/T/pip-yeU00T-record/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/djangodev/include/site/python2.6 failed with error code 1 in /private/tmp/djangodev/build/mysql-python
Storing debug log for failure in /Users/h0925473/.pip/pip.log

当我用 Django 和pip freeze > requirements.txt 进一步启动项目时: 教程提到 requirements.txt 应该包含:

Django==1.4.1
MySQL-python==1.2.3

但我的 requirements.txt 只是:

Django==1.4.1
wsgiref==0.1.2

这是否意味着我的 MySql 安装失败了?如果是这样,我该如何解决?

【问题讨论】:

  • 前几天我遇到了这个问题。您将需要安装一些系统软件包。你用的是什么系统?没关系。我看到你在 Mac 上。
  • 首先你需要安装一个不同的包。我不在 osx 中开发,但我相信 mac 使用 apt,所以我 假设 包将被命名为相同。试试sudo apt-get install python-mysqldb,如果安装了,请告诉我
  • 它不起作用,我tred brew install python-mysqldb,也不起作用。似乎 python-mysqldb 不是 mac 中的确切措辞

标签: python mysql django amazon-web-services virtualenv


【解决方案1】:

来自this

试试

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install mysql-python==1.2.3

【讨论】:

    猜你喜欢
    • 2020-03-24
    • 2014-03-06
    • 2014-12-13
    • 2012-02-24
    • 2013-06-14
    • 2015-06-28
    • 2012-07-04
    • 2020-10-08
    • 2015-01-06
    相关资源
    最近更新 更多