[英]Installing Flask project can't open setup.py
I am following the Deploy to Production tutorial from Flask.我正在关注 Flask 的部署到生产教程。 I am required to run python setup.py bdist_wheel
to build a wheel build distribution file.我需要运行python setup.py bdist_wheel
来构建一个轮子构建分发文件。 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?教程告诉我要使用的 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.本教程的上一步将引导您使用setup.py
文件安装您的项目。 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.链接教程步骤的总结是:创建以下setup.py
文件来描述您的项目,然后使用 pip 在 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.