当前位置:   article > 正文

python安装matplotlib模块出错_mac os x python安装matplotlib 库 出错: Operation not permitted...

mac系统python安装matplotlib提示语法错误

使用pip安装: sudo pip install matplotlibPassword:

The directory '/Users/rocky/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/rocky/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.

Requirement already satisfied: matplotlib in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

Requirement already satisfied: numpy>=1.5 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)

Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)

Collecting tornado (from matplotlib)

Downloading tornado-4.4.3.tar.gz (463kB)

100% |████████████████████████████████| 471kB 84kB/s

Requirement already satisfied: pyparsing>=1.5.6 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)

Collecting nose (from matplotlib)

Downloading nose-1.3.7-py2-none-any.whl (154kB)

100% |████████████████████████████████| 163kB 75kB/s

Collecting singledispatch (from tornado->matplotlib)

Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl

Collecting certifi (from tornado->matplotlib)

Downloading certifi-2017.1.23-py2.py3-none-any.whl (382kB)

100% |████████████████████████████████| 389kB 105kB/s

Collecting backports_abc>=0.4 (from tornado->matplotlib)

Downloading backports_abc-0.5-py2.py3-none-any.whl

Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from singledispatch->tornado->matplotlib)

Installing collected packages: singledispatch, certifi, backports-abc, tornado, nose

Running setup.py install for tornado ... done

Exception:

Traceback (most recent call last):

File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main

status = self.run(options, args)

File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run

prefix=options.prefix_path,

File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 784, in install

**kwargs

File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 851, in install

self.move_wheel_files(self.source_dir, root=root, prefix=prefix)

File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files

isolated=self.isolated,

File "/Library/Python/2.7/site-packages/pip/wheel.py", line 377, in move_wheel_files

clobber(source, dest, False, fixer=fixer, filter=filter)

File "/Library/Python/2.7/site-packages/pip/wheel.py", line 316, in clobber

ensure_dir(destdir)

File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir

os.makedirs(path)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs

makedirs(head, mode)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs

mkdir(name, mode)

OSError: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/man'

分析了原因后,以为权限不够,所以就把这个目录:

/Users/rocky/Library/Caches/pip/

做了提权: sudo /Users/rocky/Library/Caches/pip/

然后重新运行sudo pip install matplotlib

然后没有上面提示的错误。 然后在主程序中继续运行,结果还是出现:matplotlib模块没找到。

删除后重装,问题依然存在。

于是尝试用easy_install 安装, sudo easy_install matplotlib

等待了大概10多分钟,居然安装成功了。 因为下载的服务器比较慢,所以等待的时间就有点长了。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/570195
推荐阅读
相关标签
  

闽ICP备14008679号