如何使用库文件创建setup.py作为独立的

问题描述 投票:0回答:1

我有一个问题,我用python开发一个应用程序,我使用一些库,如flask,sqlalchemy等...

问题是我有一个每个库的定义版本,我想在没有互联网的另一台计算机上部署这个python应用程序,我可以创建一个包或使用setup.py并包含其他包与路径?

我已经尝试过这段代码,但是库没有导入,他们说:

ModuleNotFoundError:没有名为'cx_Oracle'的模块

我的代码是:

from distutils.core import setup

setup(
# Application name:
name="MyApplication",

# Version number (initial):
version="0.1.0",

# Packages
packages=["App","App/service"],
include_package_data=True,
install_requires=[
    "flask","cx_Oracle","pandas","sqlalchemy"
],
)
python package libraries setup.py
1个回答
0
投票

install_requires是一个setuptools setup.py关键字,应该用于指定项目最低限度需要正确运行的内容。

它不会安装这些库。

也许你应该尝试使用pyinstaller(https://www.pyinstaller.org)来准备好运行文件,以便在另一台计算机上运行。

© www.soinside.com 2019 - 2024. All rights reserved.