首页 > 解决方案 > 错误:包目录“PSM”不存在推送失败

问题描述

第一次尝试将我的烧瓶应用程序推送到 heroku 时出现此错误:

-----> Python app detected
-----> Installing python-3.6.6
-----> Installing pip
-----> Installing SQLite3
-----> Installing requirements with pip
   Obtaining file:///tmp/build_4ef7a6c864d09dbc04794509b4531098 (from -r /tmp/build_4ef7a6c864d09dbc04794509b4531098/requirements.txt (line 1))
       Complete output from command python setup.py egg_info:
       running egg_info
       writing PSM.egg-info/PKG-INFO
       writing dependency_links to PSM.egg-info/dependency_links.txt
       writing requirements to PSM.egg-info/requires.txt
       writing top-level names to PSM.egg-info/top_level.txt
       error: package directory 'PSM' does not exist

       ----------------------------------------
   Command "python setup.py egg_info" failed with error code 1 in /tmp/build_4ef7a6c864d09dbc04794509b4531098/
 !     Push rejected, failed to compile Python app.
 !     Push failed

这是我的文件结构:

PSM/
    .vscode/
    flask_session/
    psm/(all python, JS, html etc. in here)
    PSM.egg-info/
    procfile
    requirements.txt
    setup.py

还有我的 setup.py:

from setuptools import setup

setup(
   name='PSM',
    packages=['psm'],
include_package_data=True,
install_requires=[
    'flask',
],
)

即使我更改了文件夹(PSM & psm)和 setup.py 的名称并重新制作了 egg 信息,它仍然显示:

error: package directory 'PSM' does not exist        

我已经按照此处的建议升级了设置工具,并分别按照以下链接中的建议安装了 ez setup:

命令“python setup.py egg_info”失败,错误代码为 1

“python setup.py egg_info”失败,错误代码为 1

编辑 1:开始阅读设置工具文档。希望我能在那里找到答案。

标签: pythonherokuflaskpackages

解决方案


为了解决这个问题,我做了一个新项目。首先,我按照烧瓶安装说明进行操作:

烧瓶安装设置

然后我按照快速入门指南进行操作:

烧瓶快速入门

最后,我将它转换为一个大型应用程序,因此它是一个包。

烧瓶更大的应用

然后,我用我的应用程序名称复制了我的子目录:即

PSM/
.vscode/
flask_session/
psm/(all python, JS, html etc. in here)<----COPY THIS
PSM.egg-info/
procfile
requirements.txt
setup.py

到这里

PSM2/
.vscode/
flask_session/
psm2/<--- Replaced this folder with old folder
PSM2.egg-info/
procfile
requirements.txt
setup.py

我不确定原始项目出了什么问题,但希望如果他们遇到同样的问题,这可能会对某人有所帮助!


推荐阅读