python - 诗歌后端安装包失败
问题描述
我想从 github 安装一个包。
包的设置如下:
pyproject.toml
...
build = "build.py"
[tool.poetry.dependencies]
python = "^3.7"
[build-system]
requires = ["poetry-core>=1.0.0", "cython"]
build-backend = "poetry.core.masonry.api"
build.py
from Cython.Build import cythonize
from distutils.command.build_ext import build_ext
def build(setup_kwargs):
setup_kwargs.update({
'ext_modules': cythonize(["asyncmy/*.pyx"],
language_level=3,
compiler_directives={'linetrace': True}),
'cmdclass': {'build_ext': build_ext}
})
setup.cfg
[flake8]
ignore = E501,W503,E203
我正在[MSC v.1900 64 bit (AMD64)] on win32
使用python3.7.7
+pip 21.0.1
并且当我安装这个软件包时
python -m pip install .
我得到了类似的错误
ERROR: Could not build wheels for asyncmy which use PEP 517 and cannot be installed directly
但是如果我添加一个setup.py
# setup.py
import setuptools;setuptools.setup()
该软件包可以正确安装,那么配置有什么问题?
谢谢。
解决方案
pip
不能使用诗歌作为构建后端,您需要使用poetry
.
如果您在 *nix 工作站上,您可以运行curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
安装它(有关详细信息,请参阅文档)。完成后,运行poetry install
而不是python -m pip install .
获取项目的开发安装(包括虚拟化)。
如果您想创建一个可以上传到包索引或直接安装的可分发文件,请pip
运行poetry build
.
推荐阅读
- java - 用于匹配 XML 节点的正则表达式
- angular - 如何避免在表格标题内单击会触发单击整个表格标题
- java - 如何实现参数相同但签名不同的方法
- amazon-s3 - 如何将我的文件从 s3 加载到 powerBi?
- c - 指向函数和状态机的通用指针
- angular - Three.js 和 Angular 6 不从 JSON 文件渲染对象
- php - 未定义变量:posts(查看:C:\xampp\htdocs\practiseapp\resources\views\dashboard.blade.php)
- swift - Swift Enum:表达式模式匹配问题
- tensorflow2.0 - 当 tensorflow 2.0 中的数据没有变化时,如何为梯度更新构建循环?
- php - 如何将下拉菜单项更改为选择项