我可以制作 pip 可安装包而不在 pypi 中注册包吗? [英] Can I make pip installable package without registering package in pypi?
问题描述
我正在尝试按照以下中的描述使用 python3 制作 pip 可安装包:这里的网址
我使用 sudo python setup.py install
成功安装了我的包,但是 pip install mypackage
不起作用.那是因为我没有注册/上传我的包到 PyPI 吗?(因为这是我工作的内部项目,我不允许在 PyPI 中上传包.)
来自 pip 的用户指南:
<块引用>pip 支持从 PyPI、版本控制、本地项目安装,并直接来自分发文件.
使用的命令行不同:
它们中的每一个都有一个合适的命令行用法,pip 会按以下顺序查找:
在查看要安装的项目时,pip 按照以下顺序检查每个项目的类型:
<块引用>- 项目或存档 URL.
- 本地目录(必须包含setup.py,否则pip会报错).
- 本地文件(sdist 或wheel 格式存档,遵循这些格式的命名约定).
- PEP 440 中规定的要求.
对于您的具体问题,您不需要上传到 PyPI.解决方案:
- 构建一个轮子"https://pip.pypa.io/en/stable/reference/pip_wheel/ 并分发该文件,pip 可以安装它.
- 将源的 zip 存档放在您的内部网(或共享文件系统)上的某个位置,然后调用
pip install http://intranet.url/mypackage-1.0.4.zip
I'm trying to make pip installable package with python3 following the description in : Url here
I successfully install my package using sudo python setup.py install
, however pip install mypackage
doesn't work. Is that because I didn't register/ upload my package to PyPI? (As it's an internal project for my work I'm not allowed to upload the package in PyPI. )
From pip's user guide:
pip supports installing from PyPI, version control, local projects, and directly from distribution files.
The command-line to use is different:
There is a suitable command-line use for each of them and pip looks for, in the following order:
When looking at the items to be installed, pip checks what type of item each is, in the following order:
- Project or archive URL.
- Local directory (which must contain a setup.py, or pip will report an error).
- Local file (a sdist or wheel format archive, following the naming conventions for those formats).
- A requirement, as specified in PEP 440.
For your specific problem, you don't need to upload to PyPI. Solutions:
- Build a "wheel" https://pip.pypa.io/en/stable/reference/pip_wheel/ and distribute that file, pip can install it.
- Place a zip archive of the source somewhere on your intranet (or shared file system) and call
pip install http://intranet.url/mypackage-1.0.4.zip
这篇关于我可以制作 pip 可安装包而不在 pypi 中注册包吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!