如何指定包来源?

How to specify packages source?

我的包依赖于 PyMySQL。
问题:
然后我将包上传到 test.pypi.org 并尝试安装它 pip install -U -i https://testpypi.python.org/pypi scrapy-mysql-pipeline 我的代码出现异常,因为 test.pypi.org 上的 PyMySQL 版本是 0.6.3-rc1 而不是当前的 0.7.11 我的 setup.py

import setuptools
import os

if "PY_DEV" in os.environ:
    import pypandoc
    with open('README.rst', 'w') as f:
        f.write(pypandoc.convert('README.md', 'rst'))
else:
    os.environ.update(SKIP_WRITE_GIT_CHANGELOG='1')
os.environ.update(SKIP_GENERATE_AUTHORS='1')
setuptools.setup(
    setup_requires=['pbr', ],
    pbr=True
)

我的setup.cfg:

[metadata]
name = scrapy-mysql-pipeline
author = Iaroslav Russkykh
author-email = iarruss@ya.ru
summary = Asynchronous mysql Scrapy item pipeline
license = MIT
description-file = README.rst
home-page = https://github.com/IaroslavR/scrapy-mysql-pipeline
requires-python = >=2.7
classifier =
    Development Status :: 4 - Beta
    Framework :: Scrapy
    Intended Audience :: Developers
    License :: OSI Approved :: Apache Software License
    Operating System :: OS Independent
    Programming Language :: Python
    Topic :: Internet :: WWW/HTTP

[files]
packages =
    scrapy_mysql_pipeline

[wheel]
universal = 1

requirements.txt 导致 pip 错误:No matching distribution found for pymysql>=0.7.11 (from scrapy-mysql-pipeline)

scrapy>=1.4.0
pymysql>=0.7.11

如何指定使用来自 pypi.org 的软件包?

尝试 --extra-index-url:

pip install -U --index-url=https://testpypi.python.org/pypi --extra-index-url=https://pypi.python.org/pypi scrapy-mysql-pipeline