mac下不能卸载和升级numpy的解决办法
来源:互联网 发布:ubuntu卸载搜狗拼音 编辑:程序博客网 时间:2024/05/21 17:23
之前要换电脑,听同事的建议,买了个Mac book pro,原因是说苹果对程序员比较友好。可是,前不久在使用gensim的时候(import gensim),总是报错说ValueError: numpy.dtype has the wrong size, try recompiling,在网上查了相关帖子,大约就是numpy的版本和gensim要求的版本不同,所以才报错。
然后我就想着,那就pip install -U numpy吧,但是依然报错,错误如下:
Collecting numpy
Using cached numpy-1.10.2-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whlInstalling collected packages: numpy Found existing installation: numpy 1.8.0rc1 DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project. Uninstalling numpy-1.8.0rc1:Exception:Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/commands/install.py", line 311, in run root=options.root_path, File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 640, in install requirement.uninstall(auto_confirm=True) File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 716, in uninstall paths_to_remove.remove(auto_confirm) File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_uninstall.py", line 125, in remove renames(path, new_path) File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/utils/__init__.py", line 315, in renamesshutil.move(old, new) File"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move copy2(src, real_dst) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2 copystat(src, dst) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat os.chflags(dst, st.st_flags)OSError: [Errno 1] Operation not permitted: '/var/folders/5n/vbm997m56xg3kw67y6bccn2m0000gn/T/pip-4tcBsd-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'。
然后我发现我忘了加sudo,于是试了一下sudo pip install -U numpy,结果还是不管用,报同样的错误。又去网上查,有人说是System Integrity Protection的问题,解决的办法是关闭保护SIP。刚才找了半天,没找到帮助我解决问题的那个帖子,所以我就不引用他的文章了。具体操作如下:
1. 重启电脑,电脑启动的时候按住command+R;
2. 等画面上显示苹果logo的时候之后,你会看到「OS X 工具程式」的窗口,选择终端(注意,这里选择的时候要把键盘按下去,而不是在键盘上轻击,我一开始就是轻击,然后发现电脑根本没有反应,还以为电脑坏了,原谅我也没用苹果多久);
3. 然后终端就打开了,你直接输入csrutil disable,输完之后重启;
电脑重启之后,再重新执行sudo pip install -U numpy,我这边结果如下:
The directory '/Users/lyj/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/lyj/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting numpy
Downloading numpy-1.10.2-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.7MB)
100% |████████████████████████████████| 3.7MB 21kB/s
Installing collected packages: numpy
Found existing installation: numpy 1.8.0rc1
DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling numpy-1.8.0rc1:
Successfully uninstalled numpy-1.8.0rc1
Successfully installed numpy-1.10.2
更新成功了,为了验证是否解决了我之前的问题,我又打开python,然后import gensim,这次不报错了,终于解决了我的问题。
第一次在CSDN上写文章,之前都是看别人分享经验,为了不让其他人和我一样浪费这么多时间,我决定也分享一下自己的经验,下面给出两个参考的连接:
1. 为什么要把SIP关掉 http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/
2. 重启电脑 https://support.apple.com/zh-tw/HT201314
- mac下不能卸载和升级numpy的解决办法
- mac下不能卸载和升级numpy的解决办法
- mac安装pandas失败和不能卸载升级numpy的解决方法
- Mac环境下,numpy升级问题。
- Ubuntu下VirtualBox的卸载和升级
- Mac下paragon插件卸载不完整的解决办法
- mac下移动硬盘不能往里边拷贝东西的解决办法
- mac 环境下mysql 不能删除schema问题的解决办法
- linux环境下java版本的升级和卸载
- Mac下Mysql的卸载
- sybase 卸载后不能安装的解决办法
- SQL出现错误,不能卸载的解决办法
- Mac系统下安装和卸载HomeBrew的方法
- 2003 server不能升级SP1的解决办法
- mac下的node升级
- 在MAC下升级ADT和SDK的问题
- ubuntu下内核的升级与卸载
- Ubuntu下pip3的安装、升级、卸载
- 设计模式(一):工厂模式FactoryMethod(创建型模式)
- elasticsearch由于数据特别长而找不到数据
- 语音识别博客
- iOS关于自动布局(Autolayout)SizeClass
- 100-150
- mac下不能卸载和升级numpy的解决办法
- CodeForces A. Wet Shark and Odd and Even
- Eclipse 中安装 Pydev 插件
- 如何设置进程(线程)在指定的CPU上运行
- C#索引器
- 帐号激活与忘记密码 实例
- Mina IoBuffer的特性介绍
- Java入门(一)——了解java、搭建开发平台
- eclipse 删除所有注释及空白行