Python Matplotlib未安装在virtualenv mac内部

Python Matplotlib未安装在virtualenv mac内部,python,macos,numpy,matplotlib,virtualenv,Python,Macos,Numpy,Matplotlib,Virtualenv,因此,我在全球安装了Python 3和matplotlib。如果我在虚拟环境之外运行python并导入matplotlib以检查版本,它将显示1.5.1。但是我在虚拟环境中安装matplotlib时遇到了问题。我使用命令python3-m venv-ds创建了一个虚拟环境,并激活了ds。这些是我的requirements.txt matplotlib==1.4.2 numpy==1.9.1 当我执行pip3安装-r requirements.txt时 Collecting matplot

因此,我在全球安装了Python 3和
matplotlib
。如果我在虚拟环境之外运行python并导入matplotlib以检查版本,它将显示1.5.1。但是我在虚拟环境中安装matplotlib时遇到了问题。我使用命令
python3-m venv-ds
创建了一个虚拟环境,并激活了
ds
。这些是我的
requirements.txt

matplotlib==1.4.2
numpy==1.9.1

当我执行
pip3安装-r requirements.txt时

    Collecting matplotlib==1.4.2 (from -r requirements.txt (line 1))
  Using cached matplotlib-1.4.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setup.py", line 155, in <module>
        result = package.check()
      File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setupext.py", line 962, in check
        min_version='2.3', version=version)
      File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setupext.py", line 446, in _check_for_pkg_config
        if (not is_min_version(version, min_version)):
      File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setupext.py", line 174, in is_min_version
        return found_version >= expected_version
      File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/version.py", line 70, in __ge__
        c = self._cmp(other)
      File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/version.py", line 337, in _cmp
        if self.version < other.version:
    TypeError: unorderable types: str() < int()
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.4.2]
                    python: yes [3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015,
                            21:12:44)  [GCC 4.2.1 (Apple Inc. build 5666) (dot
                            3)]]
                  platform: yes [darwin]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.10.4]
                       six: yes [using six version 1.10.0]
                  dateutil: yes [dateutil was not found. It is required for date
                            axis support. pip/easy_install may attempt to
                            install it after matplotlib.]
                      pytz: yes [pytz was not found. pip will attempt to install
                            it after matplotlib.]
                   tornado: yes [tornado was not found. It is required for the
                            WebAgg backend. pip/easy_install may attempt to
                            install it after matplotlib.]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                     pycxx: yes [Official versions of PyCXX are not compatible
                            with matplotlib on Python 3.x, since they lack
                            support for the buffer object.  Using local copy]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib
You are using pip version 7.1.2, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
收集matplotlib==1.4.2(来自-r requirements.txt(第1行)) 使用缓存的matplotlib-1.4.2.tar.gz 从命令python setup.py egg_info完成输出: 回溯(最近一次呼叫最后一次): 文件“”,第20行,在 文件“/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bb/matplotlib/setup.py”,第155行,在 结果=包。检查() 文件“/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bb/matplotlib/setupext.py”,第962行,检查中 min_version='2.3',version=version) 文件“/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bb/matplotlib/setupext.py”,第446行,检查包装配置 如果(不是最小版本(版本,最小版本)): 文件“/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bb/matplotlib/setupext.py”,第174行,is_min_版本 返回找到的\u版本>=预期的\u版本 文件“/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/version.py”,第70行,在__ c=自身.\u cmp(其他) 文件“/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/version.py”,第337行,在 如果self.version 如何在虚拟环境中安装matplotlib 1.4.2版


我的问题已标记为重复,但该链接无法解决我的问题。给出的解决方案适用于Ubuntu

您可以使用virtualenv中的系统包,并带有选项


否则,可能会对您有所帮助。

我可以通过解决matplotlib的依赖关系来实现这一点, (如果已安装
brew

然后首先执行
brew安装freetype
,然后执行
brew安装ttfautohint——使用qt
。之后,请再次尝试pip安装。

Matplotlib编译错误可能重复:TypeError:无序类型:str()