简体   繁体   English

使用 pip 在本地安装 python package

[英]install python package locally with pip

I am trying to follow this tutorial using pip to install a python package locally.我正在尝试按照本教程使用 pip 在本地安装 python package。

My structure looks like this:我的结构如下所示:

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

Per the tutorial in the ba.net-restful directory when I run pip install wheel I get this error:根据ba.net-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)

Also on Windows. Python version is 3.9.6同样在Windows上。Python版本是3.9.6

This is my setup.py这是我的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',
)

EDIT编辑

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)

EDIT 2编辑 2

I got some tips here for python 3.9 on how the setup.py should look which worked to install the package:我在这里得到了 python 3.9 的一些提示,关于setup.py应该如何安装 package:

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 代码来安装它们

Please try the following thing inside your virtualenv.请在您的 virtualenv 中尝试以下操作。

pip install wheel
pip install .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM