Python:pip找不到setup.py

时间:2014-05-07 20:33:53

标签: python pip setuptools

如何指导pip查找setup.py?我的setup.py文件位于~/setuptools-3.5.1

我跑了

dustin@dustin:~$ python setuptools-3.5.1/setup.py egg_info
running egg_info
writing requirements to setuptools.egg-info/requires.txt
writing setuptools.egg-info/PKG-INFO
writing top-level names to setuptools.egg-info/top_level.txt
writing dependency_links to setuptools.egg-info/dependency_links.txt
writing entry points to setuptools.egg-info/entry_points.txt
reading manifest file 'setuptools.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'setuptools.egg-info/SOURCES.txt'
dustin@dustin:~$ 

所以看起来一切都还好,但是当我运行pip时,我得到了

Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Storing debug log for failure in /home/dustin/.pip/pip.log

我的印象是,当我运行pip时,它找不到setup.py

4 个答案:

答案 0 :(得分:2)

导航到包含setup.py的目录并运行:

pip install -e .

答案 1 :(得分:1)

matplotlib有许多外部依赖项。其中一些是必需的。您可以在尝试pip install生成的日志文件中看到所需的列表。在你的情况下,就是这样:

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.8.1]
              dateutil: yes [dateutil was not found. It is required for date
                        axis support. pip/easy_install may attempt to
                        install it after matplotlib.]
               tornado: yes [using tornado version 3.2.1]
             pyparsing: yes [pyparsing was not found. It is required for
                        mathtext support. pip/easy_install may attempt to
                        install it after matplotlib.]
                 pycxx: yes [Couldn't import.  Using local copy.]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: no  [pkg-config information for 'freetype2' could
                        not be found.]
                   png: yes [pkg-config information for 'libpng' could not
                        be found. Using unknown version.]

============================================================================
                        * The following required packages can not be built:
                        * freetype
Complete output from command python setup.py egg_info:
============================================================================

在这里,您可以看到freetype无法找到。您需要在系统上安装它。

答案 2 :(得分:0)

有同样的问题。这可能是因为可能未安装某些依赖项。通过在ubuntu中使用包管理器安装解决了这个问题。使用以下命令

sudo apt-get install python-matplotlib

希望这有帮助。

答案 3 :(得分:0)

导航到包含setup.py的目录并运行:

pip install -e。

这对我有用。但是当我在anaconda环境终端使用“pip install -e”。[all]'“时,我仍然没有找到按钮setup.py。 相反,我使用“pip install gym [all]”并且它有效!