python - 使用 pip 在本地安装 python 包
问题描述
我正在尝试使用 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 的提示,关于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'],
)
解决方案
请在您的 virtualenv 中尝试以下操作。
pip install wheel
pip install .
推荐阅读
- sql - 没有小计的 SQL 总计
- php - php数组在循环时只返回一个数组值
- r - 每组的行数以及其他汇总函数
- sqlite - 如何在 Next.js 中更正 SQLite“没有这样的表”?
- java - 更改 Minecraft Hotbar 图标 / FileInputStream
- node.js - Discord.js:为什么它没有正确计算成员?
- javascript - Twilio 允许所有预订更新策略不起作用
- macos - Android Studio gets freezing in MacOs Big Sur Update
- wpf - 在 WiX Bootstrapper 中选择 MSI 功能
- bash - 如何在 yaml 中删除换行符