安装Flask项目无法打开setup.py [英] Installing Flask project can't open setup.py
问题描述
我正在遵循Flask的部署到生产教程.我需要运行 python setup.py bdist_wheel
来构建wheel build分发文件.但是该命令会出现此错误:
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.
本教程告诉我使用的setup.py文件在哪里?
Where is the setup.py file that the tutorial is telling me to use?
推荐答案
该页面不是独立的教程.本教程的上一步将引导您通过使用可安装项目
> setup.py 文件.这是与部署分开的步骤,因为您应该在开发和部署期间都安装项目.
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.
链接的教程步骤的摘要是:创建以下 setup.py
文件来描述您的项目,然后使用pip将项目安装在virtualenv中.
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
这篇关于安装Flask项目无法打开setup.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!