2017-10-10 175 views
0

我的軟件包取決於PyMySQL。
問題:
然後我上傳包到test.pypi.org並嘗試安裝它pip install -U -i https://testpypi.python.org/pypi scrapy-mysql-pipeline我的代碼中有一個異常,因爲PyMySQL版本在test.pypi.org上是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 = [email protected] 
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的軟件包?

回答

1

嘗試--extra-index-url

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

不是爲我工作:'標記評估失敗,請參見下面的錯誤。有關詳細信息,請參閱:http://docs.openstack.org/developer/pbr/compatibility.html#evaluate-marker -------極長的回溯跳過---------- SyntaxError :無效標記:'(--index-url = https://pypi.python.org/simple/)',解析錯誤'--index-' 錯誤在安裝命令:錯誤解析/ home/elruso /項目/python-packages/scrapy-mysql-pipeline/setup.cfg:SyntaxError:無效標記:'(--index-url = https://pypi.python.org/simple/)',解析'--index '' –

+0

嘗試'--extra-index-url'。我更新了答案。 – phd

+0

就是這樣!謝謝 –

相關問題