繁体   English   中英

熊猫未正确安装在venv中

[英]Pandas not properly installed in venv

在带有Python 2.7.12 ubuntu 2.7.12 ,我试图在virtualenv使用pip安装pandas和其他软件包。 安装过程没有任何错误。 但是,当我尝试导入熊猫时,出现以下错误:

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa
Traceback (most recent call last):
...
    import pandas as pd
  File "/usr/local/lib/python2.7/dist-packages/pandas/__init__.py", line 31, in <module>
    "extensions first.".format(module))
ImportError: C extension: umpy.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' to build the C extensions first.

我的系统具有相同版本的熊猫( 0.18.0 ),并且可以正常运行。

我尝试过但没有奏效的内容:

  • 使用--system-site-packages选项创建一个新的virtualenv。
  • 重新安装熊猫(在venv中)
  • 升级熊猫(在Venv中)
  • 升级numpy(从1.11.0到1.14.3)(在venv中)
  • 卸载numpy和pandas并再次安装pandas(在venv中)

更新numpy版本:

pip install numpy --upgrade

应该修复错误。

这看起来像与此https://github.com/pandas-dev/pandas/issues/18530类似的问题,即numpy和pandas的某些特定版本之间不匹配。 pip install numpy --upgrade对我不起作用,但是

python -m pip install pandas==0.18.0 --force-reinstall --upgrade --no-deps --no-cache

在我的案例中做到了这一点(我在新的Ubuntu 17.10,python2上遇到了这个问题)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM