【问题标题】:Numpy failing in Python3 Google App Flexible EnginePython3 Google App 灵活引擎中的 Numpy 失败
【发布时间】:2019-05-11 22:29:03
【问题描述】:

我在 App Engine (Fleixble) 中运行 Python3 并收到以下错误:

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 库“pip3 install -t /lib numpy”并将它放在我的需求文件中(不确定这是否正确)。

Requirements.txt:

Flask==1.0.2
gunicorn==19.7.1
numpy==1.15.4

我已经重新安装了几次 numpy 并收到此日志:

Collecting numpy
Using cached
https://files.pythonhosted.org/packages/74/68/2b00ba3c7390354db2a1706291750b6b7e911f6f79c0bd2184ae04f3c6fd/numpy-1.15.4-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
quandl 3.2.0 has requirement requests<2.18,>=2.7.0, but you'll have 
requests 2.19.1 which is incompatible.
Installing collected packages: numpy
Successfully installed numpy-1.15.4

任何帮助将不胜感激:)

编辑:

我遇到过这个 - https://github.com/numpy/numpy/issues/9272

但是,这似乎会影响 Python 3.6.0,而 Python 运行时解释器在 app.yaml 文件中是 3.6.4(由“3”指定)。有关 Google 的 Python 配置的更多信息,请点击此处 -https://cloud.google.com/appengine/docs/flexible/python/runtime

【问题讨论】:

    标签: python numpy google-app-engine google-cloud-platform app-engine-flexible


    【解决方案1】:

    问题是您正在为 macOS 安装内置发行版(“wheel”),但您尝试使用依赖项的环境不是 macOS。你可以根据文件名来判断:

    numpy-1.15.4-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
    

    您需要明确指定 Flex 环境所需的平台/ABI/实现选项:

    $ pip install \
        --target lib \
        --python-version 36 \
        --platform manylinux1_x86_64 \
        --abi cp36m \
        --implementation cp \
        --only-binary=:all:
        numpy
    

    确保从干净的lib 目录执行此操作,并使用最新版本的pip。

    【讨论】:

    • 好的,谢谢!现在我收到此错误 - ImportError: C extension: No module named 'pandas._libs.tslib' not built。如果您想从源目录导入 pandas,您可能需要先运行“python setup.py build_ext --inplace --force”来构建 C 扩展。如何先构建 C 扩展?
    猜你喜欢
    • 1970-01-01
    • 2021-06-19
    • 2020-04-28
    • 2021-06-03
    • 2014-04-11
    • 1970-01-01
    • 2016-08-01
    • 2018-07-15
    • 1970-01-01
    相关资源
    最近更新 更多