runtime error python_python-RuntimeError:针对API版本0xc编译的模块...

我正在尝试学习机器学习,但无法解决以下错误.

[我的环境]

> Mac High Sierra 10.13.2

> Python3.4.5

> Numpy1.13.3

[命令]

$python3 -c "import jupyter, matplotlib, numpy, pandas, scipy, sklearn"

[错误]

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb

Traceback (most recent call last):

File "/Users/uekyo/ml/env/lib/python3.4/site-packages/pandas/__init__.py", line 26, in

from pandas._libs import (hashtable as _hashtable,

File "/Users/uekyo/ml/env/lib/python3.4/site-packages/pandas/_libs/__init__.py", line 4, in

from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime

File "pandas/_libs/tslib.pyx", line 1, in init pandas._libs.tslib

ImportError: numpy.core.multiarray failed to import

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "", line 1, in

File "/Users/uekyo/ml/env/lib/python3.4/site-packages/pandas/__init__.py", line 35, in

"the C extensions first.".format(module))

ImportError: C extension: numpy.core.multiarray failed to import not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.

[我尝试过的东西]

我了解numpy是错误的.所以我尝试了下面的事情,但错误仍然出现.

?1?

sudo mv /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy_old

?2?

pip3 uninstall numpy

pip3 install numpy -I

谢谢.

最佳答案

好像是由于熊猫版本高于0.21.0和numpy

TensorFlow拉到的版本1.13.3不能很好地配合使用.

这是我最终解决的方法:

# ipython

Python 2.7.6 (default, Nov 23 2017, 15:49:48)

Type "copyright", "credits" or "license" for more information.

IPython 4.2.0 -- An enhanced Interactive Python.

? -> Introduction and overview of IPython's features.

%quickref -> Quick reference.

help -> Python's own help system.

object? -> Details about 'object', use 'object??' for extra details.

In [1]: import tensorflow as tf

---------------------------------------------------------------------------

RuntimeError Traceback (most recent call last)

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb

In [2]: !pip install pandas==0.21.0

Collecting pandas==0.21.0

/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request

has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server

to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve

this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.

SNIMissingWarning

/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLC

ontext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to f

ail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest

/security.html#insecureplatformwarning.

InsecurePlatformWarning

Downloading pandas-0.21.0-cp27-cp27mu-manylinux1_x86_64.whl (24.3MB)

100% |################################| 24.3MB 52kB/s

Requirement already satisfied: pytz>=2011k in /usr/local/lib/python2.7/dist-packages (from pandas==0.21.0)

Requirement already satisfied: numpy>=1.9.0 in /usr/local/lib/python2.7/dist-packages (from pandas==0.21.0)

Requirement already satisfied: python-dateutil in /usr/local/lib/python2.7/dist-packages (from pandas==0.21.0)

Requirement already satisfied: six>=1.5 in /usr/local/lib/python2.7/dist-packages (from python-dateutil->pandas==0.21.0)

Installing collected packages: pandas

Found existing installation: pandas 0.21.1

Uninstalling pandas-0.21.1:

Successfully uninstalled pandas-0.21.1

Successfully installed pandas-0.21.0

In [3]: del tf

In [4]: import tensorflow as tf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
runtime-core.esm-bundler.js:41 [Vue warn]: Unhandled error during execution of beforeMount hook at <App> warn @ runtime-core.esm-bundler.js:41 logError @ runtime-core.esm-bundler.js:216 handleError @ runtime-core.esm-bundler.js:208 callWithErrorHandling @ runtime-core.esm-bundler.js:160 callWithAsyncErrorHandling @ runtime-core.esm-bundler.js:166 hook.__weh.hook.__weh @ runtime-core.esm-bundler.js:2655 invokeArrayFns @ shared.esm-bundler.js:77 componentUpdateFn @ runtime-core.esm-bundler.js:5657 run @ reactivity.esm-bundler.js:178 instance.update @ runtime-core.esm-bundler.js:5814 setupRenderEffect @ runtime-core.esm-bundler.js:5822 mountComponent @ runtime-core.esm-bundler.js:5612 processComponent @ runtime-core.esm-bundler.js:5565 patch @ runtime-core.esm-bundler.js:5040 render @ runtime-core.esm-bundler.js:6332 mount @ runtime-core.esm-bundler.js:3824 app.mount @ runtime-dom.esm-bundler.js:1431 eval @ main.js:7 ./src/main.js @ app.js:85 __webpack_require__ @ app.js:359 (匿名) @ app.js:1539 __webpack_require__.O @ app.js:405 (匿名) @ app.js:1540 (匿名) @ app.js:1542 app.js:362 Uncaught TypeError: (0 , _test__WEBPACK_IMPORTED_MODULE_1__.holleTest) is not a function at eval (App.vue:77:1) at eval (runtime-core.esm-bundler.js:2675:1) at callWithErrorHandling (runtime-core.esm-bundler.js:158:1) at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:166:1) at hook.__weh.hook.__weh (runtime-core.esm-bundler.js:2655:1) at invokeArrayFns (shared.esm-bundler.js:77:1) at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5657:1) at ReactiveEffect.run (reactivity.esm-bundler.js:178:1) at instance.update (runtime-core.esm-bundler.js:5814:1) at setupRenderEffect (runtime-core.esm-bundler.js:5822:1)
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值