Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python venv中未正确安装熊猫_Python_Pandas_Numpy_Pip_Virtualenv - Fatal编程技术网

Python venv中未正确安装熊猫

Python venv中未正确安装熊猫,python,pandas,numpy,pip,virtualenv,Python,Pandas,Numpy,Pip,Virtualenv,在使用Python2.7.12的ubuntu 16.4.4上,我试图在virtualenv中安装pandas和其他一些带有pip的软件包。安装过程中没有出现任何错误。但是,当我尝试导入熊猫时,会出现以下错误: RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa Traceback (most recent call last): ... import pandas a

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

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.
RuntimeError:根据API版本0xc编译模块,但此版本的numpy是0xa
回溯(最近一次呼叫最后一次):
...
作为pd进口熊猫
文件“/usr/local/lib/python2.7/dist packages/pandas/_init__.py”,第31行,在
“扩展优先。”。格式(模块))
ImportError:C扩展名:umpy.core.multiarray未能导入未生成。如果要从源目录导入pandas,可能需要先运行“python setup.py build_ext--inplace”来构建C扩展。
我的系统有相同版本的熊猫(
0.18.0
),运行时没有任何问题

我尝试过但没有成功的:

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

更新
numpy
版本:

pip安装numpy——升级


应修复错误。

这看起来像是与此类似的问题,即numpy和pandas的某些特定版本之间不匹配。
pip安装numpy--upgrade
对我不起作用,但是

python-mpipinstall==0.18.0——强制重新安装——升级——无deps——无缓存


在我的例子中,我做了这个技巧(我在新鲜的Ubuntu 17.10,python2上遇到了这个问题)。

对不起,在你回答之前,我没有完成问题的编辑。我尝试升级熊猫和numpy,但没有成功。另外,这可能是我工作中的一个问题,因为项目的要求要求numpy 1.11.0。不带
--系统站点包的fresh env如何?如前所述,也尝试过,但出人意料地不起作用。我不知道这是否更像是一个
pip
pandas
numpy
问题,因为即使在这样的虚拟环境下
pip
安装软件包列表也会导致同样的错误。然后我会尝试
pip install numpy=1.11.0 pandas==0.18.0——强制重新安装——基于此进行升级,请注意指定numpy版本。
--no-deps
ppr不会阻止安装numpy吗?