在将pandas升级到0.19.2后,我遇到了同样的问题。我通过以下方式从Windows命令行解决了它:
pip uninstall pandas -y
pip uninstall numpy -y
pip install pandas
pip install numpy
这也破坏了我的matplotlib安装,所以我也进行了卸载/安装。
对于一个看似例行升级来说,这是非常奇怪的行为。
pip
安装Numpy和Pandas会导致出错。我会为您进行翻译。 - Carlos Cordobapip install --upgrade numpy
pip install --upgrade pandas
我必须安装这个其他的软件包:
sudo apt-get install libatlas-base-dev
看起来它是 numpy
的一个依赖项,但由于某种原因,pip
或 apt-get
不会自动安装它。
我在使用numpy 1.16.x的最新版时遇到了问题。
问题通过以下方式解决:
python3 -m pip uninstall numpy
python3 -m pip install numpy==1.14.0
%HOMEPATH%\AppData\Local\Continuum\anaconda3\python.exe pandas_script_foo.py
,我遇到了Missing required dependencies ['numpy']
错误。在我的情况下,当在Windows cmd.exe会话中运行Anaconda python.exe时,缺少Anaconda包路径定义导致了此错误。numpy软件包并未丢失,只是找不到路径。Anaconda安装包含Windows快捷方式,用于配置每个脚本运行的路径。请参见%HOMEPATH%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)
目录中的快捷方式以获取示例。请参阅%HOMEPATH%\AppData\Local\Continuum\anaconda3\cwp.py
脚本,了解Anaconda如何配置路径。以下是一个示例Windows BAT文件,它调用cwp.py设置路径,然后运行Python脚本。这是Anaconda jupyter-lab快捷方式执行的命令副本。%HOMEPATH%\AppData\Local\Continuum\anaconda3\python.exe ^
%HOMEPATH%\AppData\Local\Continuum\anaconda3\cwp.py ^
%HOMEPATH%\AppData\Local\Continuum\anaconda3 ^
%HOMEPATH%\AppData\Local\Continuum\anaconda3\python.exe ^
%HOMEPATH%\AppData\Local\Continuum\anaconda3\Scripts\jupyter-lab-script.py
你是否在安装miniconda和pandas时没有安装依赖项?
尝试先使用conda install numpy
或pip install numpy
安装numpy。
如果你使用的是Windows系统,可以从这里获取大多数需要编译的库的预编译版本。
我也遇到了同样的问题。这是在我升级numpy库后发生的。 在通过以下命令升级numpy库后,我还需要升级pandas库才能解决这个问题:
pip install --upgrade pandas
尝试:
sudo apt-get install libatlas-base-dev
现在应该可以运行了。
否则,请尝试卸载并重新安装numpy和pandas。
pip
安装pandas时,它会自动安装numpy。如果没有安装成功,请尝试以下命令:
pip install -U numpy pandas
对于conda
conda install numpy pandas
numpy
,分别是1.16.6
和1.15.4
,新安装的pandas
不能正常工作。
我通过卸载所有版本的numpy
和pandas
,然后安装最新版本来解决这个问题。$ pip uninstall numpy pandas -y
Uninstalling numpy-1.16.6:
Successfully uninstalled numpy-1.16.6
Uninstalling pandas-0.24.2:
Successfully uninstalled pandas-0.24.2
$ pip uninstall numpy pandas -y
Uninstalling numpy-1.15.4:
Successfully uninstalled numpy-1.15.4
Cannot uninstall requirement pandas, not installed
$ pip uninstall numpy pandas -y
Cannot uninstall requirement numpy, not installed
$ pip install numpy pandas
conda install -f numpy
然后conda install -f pandas
。 - Carlos Cordoba