Matplotlib要求与virtualenv中的pip安装 [英] Matplotlib requirements with pip install in virtualenv

查看:100
本文介绍了Matplotlib要求与virtualenv中的pip安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个required.txt文件,如下所示:

I have a requirements.txt file like this:

numpy
matplotlib

当我在新的virtualvenv中尝试pip install -r requirements.txt时,我得到了:

When I try pip install -r requirements.txt inside a new virtualvenv, I get this:

REQUIRED DEPENDENCIES

             numpy: no

                    * You must install numpy 1.1 or later to build

                    * matplotlib.

如果我先安装numpy,然后再安装matplotlib,那么它将起作用.但是我想继续使用pip install -r requirements.txt.有可能吗?

If I install numpy first and matplotlib after, it works. However I'd like to keep using pip install -r requirements.txt. Is it possible?

推荐答案

Matplotlib和pip看起来不太好玩.因此,我认为在这种情况下是不可能的.

Matplotlib and pip don't seem to play together very well. So I don't think it is possible in this case.

pip首先下载需求文件中列出的软件包,然后运行setup.py,但实际上并没有安装(我不太确定pip的内部结构).以这种方式准备所有软件包后,将安装它们.

pip first downloads a package listed in your requirements file and than runs setup.py, but it doesn't really install it (I'm not quite sure about the internals of pip). After all packages are prepared in this way, they are installed.

问题是matplotlib检查setup.py中是否安装了numpy(检查本身是在

The problem is, that matplotlib checks if numpy is installed in its setup.py (the check itself is defined in setupext.py). So at the moment the check is performed, numpy is not installed and the matplotlib setup.py exits with the error message you received (This may not be a bug, as it may require numpy to build).

这曾经在pip issue#24

This was once addressed in pip issue #24 and issue #25. The issues are closed but give some more details.

到目前为止,我要做的是先安装numpy,然后再安装需求文件中的所有软件包.

What I am doing up to now is to first install numpy and than install all packages from my requirements file.

有一个新的未解决问题 pip问题.

There is a new open pip issue which deals with this problem.

此问题已作为WONTFIX关闭

The issue is closed as WONTFIX

这篇关于Matplotlib要求与virtualenv中的pip安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆