如何直接点子找到
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
导航到包含 setup.py 的目录并运行:
pip install -e .
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
找不到。你需要在你的系统上安装它。
有同样的问题。这可能是因为某些依赖项可能未安装。通过在 ubuntu 中使用包管理器安装解决了这个问题。使用以下命令
sudo apt-get install python-matplotlib
希望这有帮助。
导航到包含 setup.py 的目录并运行:
pip 安装-e .
这对我有用。但是当我在 anaconda 环境终端中使用“pip install -e '.[all]'”时,我仍然找不到 massage setup.py。 相反,我使用了“pip install gym[all]”并且它起作用了!
在我的例子中,错误与“未找到文件‘setup.py’”有关,但我没想到它会找到
setup.py
,当我将pip 更新到一个版本(>21.3)时,问题得到解决可以用pyproject.toml
代替
对我来说,项目 (arelle) 没有 setup.py 文件。那是因为 arelle 使用
pyproject.toml
文件代替.
所以我预期 setup.py 不会被找到。 但我不知道为什么
pip
不能用pyproject.toml
代替。
我从 StackOverflow 评论 得知“自 21.3
以来,Pip 支持从 pyproject.toml 文件进行可编辑安装变更日志 [pip 文档]
21.3 (2021-10-11)
Support editable installs for projects that have a
and use a build backend that supports PEP 660. (#8212)pyproject.toml
我的pip是18.1版本,大概是这个原因:
$ pip --version
pip 18.1 from C:\ProgramData\Anaconda3\lib\site-packages\pip (python 3.7)
我会升级我的点子,然后再试一次......是的,我升级了点子 ...
$ python -m pip install --upgrade pip
$ pip --version
pip 23.0.1 from c:\programdata\anaconda3\lib\site-packages\pip (python 3.7)
现在我可以做这个工作流程了:
$ git clone https://github.com/Arelle/Arelle.git
$ cd arelle
$ pip install -e .
(也许我可以使用 arelle 项目上推荐的快捷方式:
pip install git+https://[email protected]/arelle/arelle.git@master
这种方法对我来说第一次失败(因为“找不到文件!”,大概是因为旧版本的 pip!)
这里有更多关于 python 包的信息