简体   繁体   English

如何将 pip install -i https://test.pypi.org/simple/ PACKAGE-NAME 更改为 pip install PACKAGE-NAME

[英]How to change pip install -i https://test.pypi.org/simple/ PACKAGE-NAME to pip install PACKAGE-NAME

I have uploaded my package to the https://test.pypi.org/ using this tutorial .我已使用本教程将我的 package 上传到https://test.pypi.org/ But, at the end, the installation works with pip install -i https://test.pypi.org/simple/ PACKAGE-NAME .但是,最后,安装与pip install -i https://test.pypi.org/simple/ PACKAGE-NAME工作。 However, I aimed at installing the package using pip install PACKAGE-NAME .但是,我的目标是使用pip install PACKAGE-NAME package 。

Anybody knows how can I change it to work with pip install PACKAGE-NAME ?任何人都知道如何将其更改为与pip install PACKAGE-NAME一起使用?

For more information, I have a setup.py file, which looks like this:有关更多信息,我有一个setup.py文件,如下所示:

from setuptools import setup
from os import path


current_dir = path.abspath(path.dirname(__file__))


with open("README.md", "r") as fh:
    long_description = fh.read()

with open(path.join(current_dir, 'requirements.txt'), 'r') as f:
    install_requires = f.read().split('\n')

setup(
      name='package name',
      version='0.0.1',
      author='author name',
      author_email='author's email',
      description='description',
      long_description=long_description,
      long_description_content_type="text/markdown",
      license='License',
      packages=['package name'],
      keywords='keywords',
      classifiers=[
              "Programming Language :: Python :: 3",
              "License :: OSI Approved :: MIT License",
              "Operating System :: OS Independent"
              ],
      python_requires='>=3.6'
      )

and I have also a setup.cfg file, which is:我还有一个setup.cfg文件,它是:

[build_sphinx]
source-dir = docs
build-dir = docs/_build
all_files = 1

[upload_sphinx]
upload-dir = docs/_build/html

[easy_install]

If you are on Linux/Mac try this:如果你在 Linux/Mac 上试试这个:
In the user's home directory在用户的主目录中

$ mkdir -p ~/.pip
$ touch ~/.pip/pip.conf

Add this config in ~/.pip/pip.conf在 ~/.pip/pip.conf 中添加此配置

[global]
index-url=https://test.pypi.org/simple/
trusted-host=test.pypi.org

Then run pip install package-name然后运行pip install package-name

It should now directly download from the test index.它现在应该直接从测试索引下载。

I found the issue with my problem today.我今天发现了我的问题。 When you upload your package on https://test.pypi.org/ , the installation using pip works with:当您在https://test.pypi.org/上上传 package 时,使用pip的安装适用于:

pip install -i https://test.pypi.org/simple/ PACKAGE-NAME 

to be able to install the package with pip install PACKAGE-NAME , you should upload it on https://pypi.org/ .为了能够安装 package 和pip install PACKAGE-NAME ,您应该将其上传到https://pypi.org/

Therefore, I needed to walk through the steps in the tutorial for pypi , not for test.pypi .因此,我需要完成pypi教程中的步骤,而不是test.pypi

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 &#39;python -m pip install 之间的区别<package-name> &#39; 和 &#39;pip 安装<package-name> &#39; - Difference between 'python -m pip install <package-name>' and 'pip install <package-name>' 是否可以(以及如何)查看使用“pip install package-name”安装的 package 的 Python 源代码? - Is it possible (and how) to see the Python source code for the package that is installed with 'pip install package-name'? 为什么这个命令需要为 PIP &quot;py -m pip install<package-name> - Why is this command need to for PIP "py -m pip install <package-name> 使用pip install时出错:“找不到满足要求的版本<package-name> ” - Error when using pip install: “Could not find a version that satisfies the requirement <package-name>” 上载到test.pypi.org后的pip包错误 - pip package error after uploading to test.pypi.org 如何使用pip安装软件包并将名称保存到文件以便以后安装 - How to install package using pip and save name to file to install it later 如何使用诗歌从 test.pypi.org 安装软件包? - How do I install packages from test.pypi.org using poetry? PyPI package 测试:403 Forbidden from https://test.pypi.org/legacy/ - PyPI package testing: 403 Forbidden from https://test.pypi.org/legacy/ 当“pip install”时会发生什么 <package name> ” - What happens when “pip install <package name>” 我可以使用pip从PyPI安装我自己的软件包吗? - Can I use pip to install my own package from PyPI?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM