virtualenv下使用matplotlib

Unable to “import matplotlib.pyplot as plt” in virtualenv

 

(PyMVPA) SimilarFacedeMacBook-Pro:PyMVPA similarface$ pip install matplotlib

Collecting matplotlib

  Downloading matplotlib-2.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (13.2MB)

    100% |████████████████████████████████| 13.2MB 18kB/s 

Collecting pytz (from matplotlib)

  Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)

    100% |████████████████████████████████| 512kB 3.8kB/s 

Collecting six>=1.10 (from matplotlib)

  Downloading six-1.11.0-py2.py3-none-any.whl

Collecting backports.functools-lru-cache (from matplotlib)

  Downloading backports.functools_lru_cache-1.4-py2.py3-none-any.whl

Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)

  Using cached pyparsing-2.2.0-py2.py3-none-any.whl

Requirement already satisfied: numpy>=1.7.1 in ./lib/python2.7/site-packages (from matplotlib)

Collecting python-dateutil>=2.0 (from matplotlib)

  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)

    100% |████████████████████████████████| 194kB 70kB/s 

Collecting cycler>=0.10 (from matplotlib)

  Using cached cycler-0.10.0-py2.py3-none-any.whl

Collecting subprocess32 (from matplotlib)

  Downloading subprocess32-3.2.7.tar.gz (54kB)

    100% |████████████████████████████████| 61kB 46kB/s 

Building wheels for collected packages: subprocess32

  Running setup.py bdist_wheel for subprocess32 ... done

  Stored in directory: /Users/similarface/Library/Caches/pip/wheels/7d/4c/a4/ce9ceb463dae01f4b95e670abd9afc8d65a45f38012f8030cc

Successfully built subprocess32

Installing collected packages: pytz, six, backports.functools-lru-cache, pyparsing, python-dateutil, cycler, subprocess32, matplotlib

Successfully installed backports.functools-lru-cache-1.4 cycler-0.10.0 matplotlib-2.1.0 pyparsing-2.2.0 python-dateutil-2.6.1 pytz-2017.3 six-1.11.0 subprocess32-3.2.7

(PyMVPA) SimilarFacedeMacBook-Pro:PyMVPA similarface$ python

Python 2.7.10 (default, Jul 14 2015, 19:46:27) 

[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> from matplotlib import pylab

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/Users/similarface/virtualenvs/PyMVPA/lib/python2.7/site-packages/matplotlib/pylab.py", line 257, in <module>

    from matplotlib import cbook, mlab, pyplot as plt

  File "/Users/similarface/virtualenvs/PyMVPA/lib/python2.7/site-packages/matplotlib/pyplot.py", line 113, in <module>

    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()

  File "/Users/similarface/virtualenvs/PyMVPA/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 60, in pylab_setup

    [backend_name], 0)

  File "/Users/similarface/virtualenvs/PyMVPA/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 19, in <module>

    from matplotlib.backends import _macosx

RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

>>> 

(PyMVPA) SimilarFacedeMacBook-Pro:PyMVPA similarface$ cd ~/.matplotlib/

(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$ vi matplotlibrc

 

(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$ cat matplotlibrc

backend: TkAgg

 

(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$ python

Python 2.7.10 (default, Jul 14 2015, 19:46:27) 

[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> from matplotlib import pylab

>>> ^D

(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$ 

(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$ 

(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$ 

(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$ 

 

转载于:https://www.cnblogs.com/similarface/p/7883573.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值