Installing Flask project can't open setup.py

微笑、不失礼 提交于 2019-12-10 19:47:08

问题


I am following the Deploy to Production tutorial from Flask. I am required to run python setup.py bdist_wheel to build a wheel build distribution file. But that command gives this error:

python: can't open file 'setup.py': [Errno 2] No such file or directory

After searching, I found out that the file is supposed to be at the root of the library I am using. I couldn't find it at the root of the wheel or flask libraries.

Where is the setup.py file that the tutorial is telling me to use?


回答1:


That page is not a standalone tutorial. A previous step in the tutorial walks you through making your project installable with a setup.py file. It's a separate step from deploying because you should install your project both during development and deployment.

The summary of the linked tutorial step is: create the following setup.py file to describe your project, then use pip to install the project in the virtualenv.

from setuptools import find_packages, setup

setup(
    name='flaskr',
    version='1.0.0',
    packages=find_packages(),
    include_package_data=True,
    install_requires=[
        'flask',
    ],
)
# install during development
pip install -e .

# install in production
pip install flaskr-1.0.0-py3-none-any.whl


来源:https://stackoverflow.com/questions/52058876/installing-flask-project-cant-open-setup-py

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!