MacOS使用pip安装pandas提示Cannot uninstall 'numpy'解决方案

本人在从新搭建本身的电脑的plotly环境的时候遇到一个坑,就是使用pip安装pandas的时候一直提示:python

pip uninstall numpy
Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

因为英文水平有限,期初觉得是权限不够,加上sudo依然报错。在借助工具翻译了以后,发现是没法卸载numpy,缘由以下:git

这是一个distutils安装的项目,所以咱们没法准确肯定哪些文件属于它,这将致使仅部分卸载。

原来numpy是标准库的东西,让我想起window系统里面有些软件安装时候会放在system文件夹下,致使提示没法准确识别须要卸载删除的文件致使卸载失败的状况。虽然不清楚为啥装pandas须要先卸载numpy,可是使用pip先安装了一波。提示以下:api

Requirement already satisfied: numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (1.8.0rc1)

仍是不行,干脆直接删除了。提醒一下先备份,而后在安装从新安装numpy,这样保险一些。markdown

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python$ ls | grep numpy
numpy-1.8.0rc1-py2.7.egg-info
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python$ sudo mv numpy-1.8.0rc1-py2.7.egg-info /Users/fv/
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python$

下面放一下我安装命令,用的源是清华的,豆瓣的老提示链接失败。工具

sudo pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple numpy
sudo pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple pandas
划重点,还有一些坑:
看国外网友是3.+的版本bug比较多,我果真滚回来2.4
新电脑必定要注意相关依赖库的版本,有时候plotly提示找不到模块,只是由于版本过低了。

欢迎有兴趣的童鞋一块儿交流ui

相关文章
相关标签/搜索