简体   繁体   中英

install python package locally with pip

I am trying to follow this tutorial using pip to install a python package locally.

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:

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

This is my 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

I got some tips here for python 3.9 on how the setup.py should look which worked to install the 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.

pip install wheel
pip install .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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