在 macOS High Sierra 上安装 mysql-python

2024-04-23

我正在尝试安装mysql-pythonPython 2.7.10 中使用命令的库pip install mysql-python。这会导致以下错误:

Collecting mysql-python
  Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: mysql-python
  Running setup.py bdist_wheel for mysql-python ... error
  Complete output from command /Users/matt/env/identity/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/jd/57tcbb295t13k0t10kvrqrxh0000gn/T/pip-build-VuUKuW/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/jd/57tcbb295t13k0t10kvrqrxh0000gn/T/tmpmJbYFMpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.13-intel-2.7
  copying _mysql_exceptions.py -> build/lib.macosx-10.13-intel-2.7
  creating build/lib.macosx-10.13-intel-2.7/MySQLdb
  copying MySQLdb/__init__.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
  copying MySQLdb/converters.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
  copying MySQLdb/connections.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
  copying MySQLdb/cursors.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
  copying MySQLdb/release.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
  copying MySQLdb/times.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
  creating build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/CR.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/ER.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
  running build_ext
  building '_mysql' extension
  creating build/temp.macosx-10.13-intel-2.7
  cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.7.19/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.13-intel-2.7/_mysql.o
  _mysql.c:287:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                  cmd_argc = PySequence_Size(cmd_args);
                           ~ ^~~~~~~~~~~~~~~~~~~~~~~~~
  _mysql.c:317:12: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                  groupc = PySequence_Size(groups);
                         ~ ^~~~~~~~~~~~~~~~~~~~~~~
  _mysql.c:470:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                          int j, n2=PySequence_Size(fun);
                                 ~~ ^~~~~~~~~~~~~~~~~~~~
  _mysql.c:1127:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                  len = mysql_real_escape_string(&(self->connection), out, in, size);
                      ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  _mysql.c:1129:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                  len = mysql_escape_string(out, in, size);
                      ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  _mysql.c:1168:9: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
          size = PyString_GET_SIZE(s);
               ~ ^~~~~~~~~~~~~~~~~~~~
  /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:92:32: note: expanded from macro 'PyString_GET_SIZE'
  #define PyString_GET_SIZE(op)  Py_SIZE(op)
                                 ^~~~~~~~~~~
  /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/object.h:116:56: note: expanded from macro 'Py_SIZE'
  #define Py_SIZE(ob)             (((PyVarObject*)(ob))->ob_size)
                                   ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
  _mysql.c:1178:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                  len = mysql_real_escape_string(&(self->connection), out+1, in, size);
                      ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  _mysql.c:1180:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                  len = mysql_escape_string(out+1, in, size);
                      ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  _mysql.c:1274:11: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
          if ((n = PyObject_Length(o)) == -1) goto error;
                 ~ ^~~~~~~~~~~~~~~~~~
  /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:434:25: note: expanded from macro 'PyObject_Length'
  #define PyObject_Length PyObject_Size
                          ^
  _mysql.c:1466:10: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                          len = strlen(buf);
                              ~ ^~~~~~~~~~~
  _mysql.c:1468:10: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                          len = strlen(buf);
                              ~ ^~~~~~~~~~~
  _mysql.c:1504:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                                  len = strlen(buf);
                                      ~ ^~~~~~~~~~~
  _mysql.c:1506:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                                  len = strlen(buf);
                                      ~ ^~~~~~~~~~~
  _mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
          if (how < 0 || how >= sizeof(row_converters)) {
              ~~~ ^ ~
  14 warnings generated.
  In file included from _mysql.c:44:
  /usr/local/Cellar/mysql/5.7.19/include/mysql/my_config.h:173:9: warning: 'SIZEOF_LONG' macro redefined [-Wmacro-redefined]
  #define SIZEOF_LONG      8
          ^
  /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:54:17: note: previous definition is here
  #        define SIZEOF_LONG             4
                  ^
  In file included from _mysql.c:44:
  /usr/local/Cellar/mysql/5.7.19/include/mysql/my_config.h:178:9: warning: 'SIZEOF_TIME_T' macro redefined [-Wmacro-redefined]
  #define SIZEOF_TIME_T    8
          ^
  /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:57:17: note: previous definition is here
  #        define SIZEOF_TIME_T           4
                  ^
  _mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
          if (how < 0 || how >= sizeof(row_converters)) {
              ~~~ ^ ~
  3 warnings generated.
  cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.13-intel-2.7/_mysql.o -L/usr/local/Cellar/mysql/5.7.19/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.13-intel-2.7/_mysql.so
  ld: library not found for -lssl
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'cc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for mysql-python
  Running setup.py clean for mysql-python
Failed to build mysql-python
Installing collected packages: mysql-python
  Running setup.py install for mysql-python ... error
    Complete output from command /Users/matt/env/identity/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/jd/57tcbb295t13k0t10kvrqrxh0000gn/T/pip-build-VuUKuW/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/jd/57tcbb295t13k0t10kvrqrxh0000gn/T/pip-S7QKxD-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/matt/env/identity/include/site/python2.7/mysql-python:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-intel-2.7
    copying _mysql_exceptions.py -> build/lib.macosx-10.13-intel-2.7
    creating build/lib.macosx-10.13-intel-2.7/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
    creating build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.macosx-10.13-intel-2.7
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.7.19/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.13-intel-2.7/_mysql.o
    _mysql.c:287:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                    cmd_argc = PySequence_Size(cmd_args);
                             ~ ^~~~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:317:12: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                    groupc = PySequence_Size(groups);
                           ~ ^~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:470:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                            int j, n2=PySequence_Size(fun);
                                   ~~ ^~~~~~~~~~~~~~~~~~~~
    _mysql.c:1127:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                    len = mysql_real_escape_string(&(self->connection), out, in, size);
                        ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:1129:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                    len = mysql_escape_string(out, in, size);
                        ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:1168:9: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
            size = PyString_GET_SIZE(s);
                 ~ ^~~~~~~~~~~~~~~~~~~~
    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:92:32: note: expanded from macro 'PyString_GET_SIZE'
    #define PyString_GET_SIZE(op)  Py_SIZE(op)
                                   ^~~~~~~~~~~
    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/object.h:116:56: note: expanded from macro 'Py_SIZE'
    #define Py_SIZE(ob)             (((PyVarObject*)(ob))->ob_size)
                                     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    _mysql.c:1178:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                    len = mysql_real_escape_string(&(self->connection), out+1, in, size);
                        ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:1180:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                    len = mysql_escape_string(out+1, in, size);
                        ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:1274:11: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
            if ((n = PyObject_Length(o)) == -1) goto error;
                   ~ ^~~~~~~~~~~~~~~~~~
    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:434:25: note: expanded from macro 'PyObject_Length'
    #define PyObject_Length PyObject_Size
                            ^
    _mysql.c:1466:10: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                            len = strlen(buf);
                                ~ ^~~~~~~~~~~
    _mysql.c:1468:10: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                            len = strlen(buf);
                                ~ ^~~~~~~~~~~
    _mysql.c:1504:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                                    len = strlen(buf);
                                        ~ ^~~~~~~~~~~
    _mysql.c:1506:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                                    len = strlen(buf);
                                        ~ ^~~~~~~~~~~
    _mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
            if (how < 0 || how >= sizeof(row_converters)) {
                ~~~ ^ ~
    14 warnings generated.
    In file included from _mysql.c:44:
    /usr/local/Cellar/mysql/5.7.19/include/mysql/my_config.h:173:9: warning: 'SIZEOF_LONG' macro redefined [-Wmacro-redefined]
    #define SIZEOF_LONG      8
            ^
    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:54:17: note: previous definition is here
    #        define SIZEOF_LONG             4
                    ^
    In file included from _mysql.c:44:
    /usr/local/Cellar/mysql/5.7.19/include/mysql/my_config.h:178:9: warning: 'SIZEOF_TIME_T' macro redefined [-Wmacro-redefined]
    #define SIZEOF_TIME_T    8
            ^
    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:57:17: note: previous definition is here
    #        define SIZEOF_TIME_T           4
                    ^
    _mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
            if (how < 0 || how >= sizeof(row_converters)) {
                ~~~ ^ ~
    3 warnings generated.
    cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.13-intel-2.7/_mysql.o -L/usr/local/Cellar/mysql/5.7.19/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.13-intel-2.7/_mysql.so
    ld: library not found for -lssl
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'cc' failed with exit status 1

    ----------------------------------------
Command "/Users/matt/env/identity/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/jd/57tcbb295t13k0t10kvrqrxh0000gn/T/pip-build-VuUKuW/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/jd/57tcbb295t13k0t10kvrqrxh0000gn/T/pip-S7QKxD-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/matt/env/identity/include/site/python2.7/mysql-python" failed with error code 1 in /private/var/folders/jd/57tcbb295t13k0t10kvrqrxh0000gn/T/pip-build-VuUKuW/mysql-python/

我已经在 StackOverflow 中搜索了这个问题,并且已经尝试了各种修复方法。

xcode-select --install给出以下信息:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

一个答案here https://stackoverflow.com/a/40592989/5083045建议尝试这段代码:

brew uninstall mysql
brew install mysql-connector-c
pip install mysql-python
brew unlink mysql-connector-c
brew install mysql

我已经运行了这个,错误消息没有改变。跑步brew list表明mysql, mysql-connector-c and openssl已安装。

请注意,我使用的是 macOS High Sierra 测试版,这可能就是其他各种修复程序不起作用的原因。


尝试了许多其他解决方案,包括卸载、重新安装、使用 pip、brew 等。在调用命令时添加环境链接器变量:

env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip2.7 install -r requirements.txt

示例显示了一个需求文件,但可能只是您的 mysql-python

macOS 塞拉利昂 画中画2.7

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 macOS High Sierra 上安装 mysql-python 的相关文章

  • PHP mysql 土耳其语字符编码及比较

    我正在尝试通过 AJAX POST 从 MySql 数据库中过滤土耳其语姓名 英文字母单词列出一切正常 但是如果我发送 这是带点的字母 O 结果不仅是 还包括 O 和 另外我注意到 AJAX 帖子被发送 作为 C3 96 有人可以帮忙吗 请
  • 在 Python、Django 中下载的文件始终为空

    我在 Django 中使用以下视图来创建文件并使浏览器下载它 def aux pizarra request myfile StringIO StringIO myfile write hello response HttpResponse
  • 显示不同表中的名称而不是 ID

    我有 2 张桌子 Category带主键ID和列Name Employee带主键ID和列Category id Note Category id现在显示ID正确地 我想展示Name代替ID对于输出Employee Attempt categ
  • 从 Inno Setup 项目内部调用 MySQL

    我正在为一些使用 MySQL 的软件编写安装程序 我正在尝试运行 sql用于在安装时设置数据库的脚本 唉 我目前在执行它时遇到了很大的问题 这个问题似乎是由于这样一个事实而产生的 当你设置一条通往 sql文件内的 execute SOURC
  • 如何避免绘图散点图中的文本重叠?

    我正在寻找一种解决方案来避免文本标签中的文本重叠 我用散点图创建图像 也许这里有自动化 from pandas import util import plotly express as px import plotly graph obje
  • 为什么 Keras 的 train_on_batch 在第二个 epoch 产生零损失和准确率?

    我正在使用一个大数据集 所以我尝试使用 train on batch 或适合 epoch 1 model Sequential model add LSTM size input shape input shape return seque
  • 如何将异步函数传递给 Python 中的线程目标?

    我有以下代码 async some callback args await some function 我需要将它作为目标传递给线程 thread threading Thread target some callback args som
  • Python:Tkinter Treeview 可搜索

    相当直接的问题 尽管我用了最好的谷歌搜索 但我找不到任何相关内容 我有一个 Python 应用程序 它使用 Tkinter Treeview 小部件作为表格 这对于我需要使用它的用途来说效果很好 但最终会在一些树中出现几百个项目 无论如何
  • 使用 Python 发布 XML 文件

    我是 Python 新手 需要一些帮助 我的目标是向 URL 发送一些带有 post 请求的 XML 这将触发发送 SMS 我有一个小的 XML 文档 我想将其发布到 URL 我可以在需要发布的 python 代码中引用我的服务器上的 XM
  • 解析日期字符串

    我在 post 变量中有这个字符串 03 21 2011 我需要通过php解析它并将其转换成这种格式 2011 03 21 我正在使用 php 我需要这种格式 以便我可以运行此查询 SELECT prospect as Prospect c
  • 在Python中将一个方法(带参数)传递给另一个方法的最佳方法是什么

    将方法和方法参数传递给另一个方法的最佳方法是什么 有更好的方法来执行以下操作吗 def method1 name return Hello name def method2 methodToCall methodToCallParams q
  • 屏幕截图中低分辨率文本的 OCR

    我正在编写一个 OCR 应用程序来从屏幕截图图像中读取字符 目前 我只关注数字 我的方法部分基于这篇博文 http blog damiles com 2008 11 basic ocr in opencv http blog damiles
  • 如何在matplotlib_venn中将维恩图保存为PNG图

    使用以下代码我尝试创建维恩图 然后另存为文件 import matplotlib from matplotlib venn import venn2 set1 set A B C D set2 set B C D E plt venn2 s
  • admin.py 用于项目,而不是应用程序

    如何指定项目级别admin py 我前段时间问过这个问题 但由于该问题缺乏活动 我刚刚获得了风滚草奖 gt Project 设置 py admin py 这就是我想要开始工作的 App admin py 我知道该怎么做 例如 admin a
  • 应用函数创建以多列作为参数的字符串

    我有一个像这样的数据框 name size type av size type 0 John 23 Qapra 22 1 Dan 21 nuk neH 12 2 Monica 12 kahless 15 我想用一个句子创建一个新列 如下所示
  • 为什么在尝试导入随机模块时会收到 TypeError: 'module' object is not callable ?

    我正在使用 Python 2 6 并尝试运行一个简单的随机数生成器程序 random py import random for i in range 5 random float 0 0 lt number lt 1 0 print ran
  • 使用 python mechanize 库登录 https 站点

    我有以下代码 import requests import sys import urllib2 import re import mechanize import cookielib import json import imp prin
  • Python 正则表达式 findall

    我正在尝试使用 Python 2 7 2 中的正则表达式从字符串中提取所有出现的标记单词 或者简单地说 我想提取其中的每一段文本 p p 标签 这是我的尝试 regex ur u005B1P u005D u005B u002FP u005D
  • Keras 导入错误 Nadam

    我在尝试导入 Keras 模块 Nadam 时遇到导入错误 gt gt gt from keras optimizers import Nadam Traceback most recent call last File
  • 与 IPython 内核分离而不终止它

    有人可以告诉我如何在不终止 IPython 内核的情况下分离它吗 我在文档中看到quit 有一个参数keep kernel 但不幸的是quit keep kernel True 行不通的 如果您通过 IPython 控制台客户端连接到内核并

随机推荐