我的印象是(使用setuptools):
python setup.py develop
Run Code Online (Sandbox Code Playgroud)
安装所需的软件包(在install_requires中指定)时不会使用轮子.
问题:
我在谈论这个特殊的安装脚本.
背景:我有一个负责安全的源文件。其中有魔术键和特定算法。
是否可以从 python 蛋或轮包中删除这个单一的源文件?
我已经完成了使用 egg 命令只发送二进制文件。
python setup.py bdist_egg --exclude-source-files
Run Code Online (Sandbox Code Playgroud)
编辑项目结构:
??? setup.py
??? src
| ??? __init__.py
| ??? file1.py
| ??? file2.py
| ??? file_to_exclude.py
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
我已经将我的私人回购打包成一个轮子。有不同版本的轮子。是否可以从命令行使用 pip 和通过 requirements.txt 文件安装特定轮版本的 repo?据我所知,pip 文档中没有提到此功能。
我可以使用 Github 令牌从私有存储库安装 pip 包,没有问题。
pip install git+https://$GITHUB_TOKEN@github.com/[username]/[reponame].git
我还可以安装带有特定提交的私有 pip 包:
pip install git+https://$GITHUB_TOKEN@github.com/[username]/[reponame].git@[commit_sha]
在我的项目中,我有一个 setup.py 文件,它使用以下命名空间模式构建多个模块:
from setuptools import setup
setup(name="testmoduleserver",
packages=["testmodule.server","testmodule.shared"],
namespace_packages=["testmodule"])
setup(name="testmoduleclient",
packages=["testmodule.client","testmodule.shared"],
namespace_packages=["testmodule"])
Run Code Online (Sandbox Code Playgroud)
我正在尝试为这两个包构建轮文件。但是,当我这样做时:
python -m pip wheel .
Run Code Online (Sandbox Code Playgroud)
它只为定义之一构建包。
为什么只构建一个包?
一些背景:
我正在从事的项目使用python-ldap库。由于我们是一个混合操作系统开发团队(一些使用 Linux,一些使用 macOS 和一些 Windows),我试图让项目在所有环境中构建。不幸的是,python-ldapWindows 没有正式支持,但有由 Christoph Gohlke 维护的非官方轮子。我已经测试了轮文件,它工作正常。
问题:我如何告诉 Poetry 在 Windows 上使用轮子以及python-ldap在 Linux 和 macOS 上使用官方包?
我尝试了多种方法,包括使用多个约束依赖项和标记:
python-ldap = [
{ markers = "sys_platform == 'linux'", version = "*" },
{ markers = "sys_platform == 'win32'", path="lib/python_ldap-3.2.0-cp36-cp36m-win_amd64.whl" }
Run Code Online (Sandbox Code Playgroud)
......但是,从判断poetry.lock文件,似乎再标记合并,只是确定是否库应安装在所有:
[[package]]
category = "main"
description = "Python modules for implementing LDAP clients"
marker = "sys_platform == \"linux\" or sys_platform == \"win32\""
name = …Run Code Online (Sandbox Code Playgroud) 在运行安装脚本之前,有没有一种简单的方法可以知道 Python 轮子的文件名?
我正在尝试生成一个 Bazel 规则,为计算机中安装的每个 Python 版本构建一个 .whl,该库包含本机代码,因此需要为每个版本单独编译。Bazel 的问题是它需要提前声明任何输出,我观察到每个 Python 版本都会生成不同的文件名,没有明显的一致性(malloc 和 unicode 的前缀不同)
2.7 --> lib-0.0.0-cp27-cp27mu-linux_x86_64.whl
3.6m --> lib-0.0.0-cp36-cp36m-linux_x86_64.whl
3.8 --> lib-0.0.0-cp36-cp38-linux_x86_64.whl
Run Code Online (Sandbox Code Playgroud)
我知道作为一种解决方法,我可以拉紧轮子来传递它,但我想知道是否有更干净的方法来做到这一点。
考虑以下包结构:
有以下setup.py内容:
from setuptools import setup, find_packages
setup(
name='dfl_client',
packages=find_packages(exclude=['*tests*']),
include_package_data=True,
package_data={"": ['py.typed', '*.pyi']},
)
Run Code Online (Sandbox Code Playgroud)
当我使用 打包它时python setup.py sdist bdist_wheel,产生的轮子:
py.typed文件,这很好tests的文件夹,而应根据被排除的find_packages文档。我花了几个小时试图理解为什么没有成功。特别是因为它似乎适用于其他项目!
我在 Python 中遇到一个奇怪的问题,问题是cryptography-2.9.2-cp35-abi3-manylinux2010_x86_64.whl在 SLES 操作系统上不起作用。
我将 CI/CD 添加到我的存储库中,当我将包从requirements.txt 下载到本地文件夹时dist-packages。Jenkins Slave 机器在 RedHat Linux 上运行。因此,它是用这个文件下载的,cryptography-2.9.2-cp35-abi3-manylinux2010_x86_64.whl而我的运行时是在 SLES OS 11 中,这需要cryptography-2.9.2-cp35-abi3-manylinux1_x86_64.whl.
这个特定的依赖项cryptography-2.9.2-cp35-abi3-manylinux2010_x86_64.whl是从 RedHat 下载的,当我将其重新分发到 SLES 操作系统时,此依赖项失败并出现以下错误。
ERROR: Could not find a version that satisfies the requirement cryptography>=2.1.4 (from azure-identity->-r requirements.txt (line 2)) (from versions: none)
ERROR: No matching distribution found for cryptography>=2.1.4 (from azure-identity->-r requirements.txt (line 2))
Run Code Online (Sandbox Code Playgroud)
如果我将依赖项名称更改为 ,cryptography-2.9.2-cp35-abi3-manylinux2010_x86_64.whl则cryptography-2.9.2-cp35-abi3-manylinux1_x86_64.whl它在 SLES OS 计算机上工作正常。
当我签入 PyPI https://pypi.org/project/cryptography/#modal-close时(这两个文件大小相同,但哈希值不同)
我想了解python包中manylinux1_x86_64与manylinux2010_x86_64之间的区别。
提前致谢。
我用诗歌创建了一个轮文件。我正在运行 Spark-submit 命令,但它不起作用。我想我错过了一些东西
spark-submit --py-files /path/to/wheel
Run Code Online (Sandbox Code Playgroud)
请注意,我也参考了下面的内容,但由于我是 Python 新手,因此没有获得太多详细信息。 如何将 python 包传递给 Spark 作业并使用参数从包中调用主文件
我使用的是 macOS Big Sur 11.0.1。
我正在设置一个virtual env
$python3 -m venv $my_workdir)/.virtualenv
Run Code Online (Sandbox Code Playgroud)
但在构建wheel包时出现此错误:
building '_openssl' extension
creating build/temp.macosx-10.14.6-x86_64-3.8/build
creating build/temp.macosx-10.14.6-x86_64-3.8/build/temp.macosx-10.14.6-x86_64-3.8
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -I/usr/local/opt/gettext/include -I/Users/engontang/devspace/energisme/terraform/tfwrapper-infra-pda/.wrapper/.virtualenv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c build/temp.macosx-10.14.6-x86_64-3.8/_openssl.c -o build/temp.macosx-10.14.6-x86_64-3.8/build/temp.macosx-10.14.6-x86_64-3.8/_openssl.o -Wconversion -Wno-error=sign-conversion
build/temp.macosx-10.14.6-x86_64-3.8/_openssl.c:575:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cryptography
Building wheel for pynacl …Run Code Online (Sandbox Code Playgroud) python-wheel ×10
python ×9
pip ×4
setuptools ×4
apache-spark ×1
egg ×1
git ×1
github ×1
pyspark ×1
python-3.6 ×1
python-3.x ×1
python-ldap ×1
python-venv ×1