【问题标题】:install python package locally with pip使用 pip 在本地安装 python 包
【发布时间】:2021-10-26 14:15:00
【问题描述】:

我正在尝试关注this tutorial,使用 pip 在本地安装 python 包。

我的结构是这样的:

bacnet-restful/
    example-node-red-flows/
    flask_version/
    images/
    swagger_json/
    scanning_scripts/
    modulepkg/
              __init__.py
              aioapp.py
              bacnet_actions.py
              models.py
              views.py
    .gitignore.txt
    LICENSE
    README
    requirements.txt
    runtime.txt
    setup.py

根据bacnet-restful 目录中的教程,当我运行pip install wheel 时出现此错误:

WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)
Requirement already satisfied: wheel in c:\python39\lib\site-packages (0.37.0)
WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)

也在 Windows 上。 Python 版本是 3.9.6

这是我的setup.py

import setuptools
 
with open("README.md", "r") as fh:
    long_description = fh.read()
 
setuptools.setup(
    name="bacnet-restful",
    version="0.0.1",
    author="author newb",
    author_email="newb.newb@gmail.com",
    description="restful BACnet App",
    long_description=long_description,
    long_description_content_type="text/markdown",
    packages=setuptools.find_packages(),
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
    python_requires='>=3.8',
)

编辑

PS C:\Desktop\bacnet-restful> pip install bacnet-restul
WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)
ERROR: Could not find a version that satisfies the requirement bacnet-restul (from versions: none)
ERROR: No matching distribution found for bacnet-restul
WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)

编辑 2

我得到了一些关于 python 3.9 的tips here setup.py 应该如何安装包:

from distutils.core import setup

setup(name='bacnet-restful',
      version='1.0',
      description='Python Distribution Utilities',
      author='author newb',
      author_email='newb.newb@mail.com',
      url='https://www.python.org/',
      py_modules=['aiohttp', 'BAC0', 'aiohttp_pydantic'],
     )

【问题讨论】:

  • 你可以使用Visual Studio代码来安装它们
  • 这不是错误。它说你已经安装了轮子。
  • 好的,我想我明白了,所以我需要将 wheel 的名称更改为我要安装的名为 bacnet-restful 的包的名称,而不是 pip install wheel。所以我需要运行pip install bacnet-restul ...?
  • 您有机会评论我所做的编辑吗?
  • @AnandTripathi 如果您发布了答案,我会点击绿色复选框。这工作pip install wheel 然后运行pip install . 我还会发布一个编辑2,用于我对我的setup.py 所做的更改

标签: python pip setuptools python-wheel


【解决方案1】:

请在你的 virtualenv 中尝试以下操作。

pip install wheel
pip install .

【讨论】:

    猜你喜欢
    • 2013-03-03
    • 2017-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-27
    • 2016-07-21
    相关资源
    最近更新 更多