gpt4 book ai didi

python - dev_appserver.py app.yaml 产生 : ImportError: Importing the multiarray numpy extension module failed

转载 作者:太空宇宙 更新时间:2023-11-04 00:10:59 25 4
gpt4 key购买 nike

我运行这个命令:

dev_appserver.py app.yaml

我得到一个错误:

Traceback (most recent call last):
File "C:\Users\sehrlich\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Users\sehrlich\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Users\sehrlich\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "C:\Users\sehrlich\Desktop\ToolKit\Application Projects\Tableau Web Data Connector Improvement\tableauextensions\main.py", line 2, in <module>
from Get_Data import get_data, build_connection, run_sql
File "C:\Users\sehrlich\Desktop\ToolKit\Application Projects\Tableau Web Data Connector Improvement\tableauextensions\Get_Data.py", line 1, in <module>
import numpy as np
File "C:\Users\sehrlich\Desktop\ToolKit\Application Projects\Tableau Web Data Connector Improvement\tableauextensions\lib\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\sehrlich\Desktop\ToolKit\Application Projects\Tableau Web Data Connector Improvement\tableauextensions\lib\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\sehrlich\Desktop\ToolKit\Application Projects\Tableau Web Data Connector Improvement\tableauextensions\lib\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\sehrlich\Desktop\ToolKit\Application Projects\Tableau Web Data Connector Improvement\tableauextensions\lib\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\sehrlich\Desktop\ToolKit\Application Projects\Tableau Web Data Connector Improvement\tableauextensions\lib\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.

我已经安装和卸载了 NumPy。当我运行类似

python -m flask run 

而且它使用 NumPy 没问题。无法弄清楚是什么问题。

最佳答案

正如 Dan Cornilescu 所说,GAE 标准不能使用包含以 C 语言编译的代码的库 [1] [2] :

[From 1] You can use third-party libraries that are pure Python code with no C extensions

[From 2] The interpreter cannot load Python services with C code; it is a "pure" Python environment.

NumPy 就是其中之一,您可以在他们的 Git Repo 中看到它 [3]在维基百科中[4] (编写于:Python、C)。另外,检查这个 SO question 的第一个答案.

奇怪的是,我在 NumPy 上发现了一个仅基于“纯”Python 的版本,名为“TinyNumPy”[5]您可以在 GAE 标准中使用。根据他们的 Git Repo,这是它的局限性:

  • ndarray.flat iterator cannot be indexed (it is a generator).
  • No support for Fortran order.
  • Support for data types limited to bool, uin8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64.
  • Functions that calculate statistics on the data are much slower, since the iteration takes place in Python.
  • Assigning via slicing is usually pretty fast, but can be slow if the striding is unfortunate.

简而言之,要么使用 GAE Flex,要么尽量避免使用 NumPy。

关于python - dev_appserver.py app.yaml 产生 : ImportError: Importing the multiarray numpy extension module failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52503620/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com