从pypi工程pip安装,但从testpypi失败(找不到要求)

时间:2015-12-29 16:06:58

标签: python pip pypi

我正在尝试创建我的第一个python包。为了不搞砸整个交易,我一直在尝试将其上传到testpypi服务器。这似乎很好(sdist创建和上传不显示任何错误)。但是,当我尝试将其安装到https://testpypi.python.org/pypi的新virtualenv时,它会抱怨我的安装要求,例如:

plot(dtf$date,dtf$open,type="l")
library(ggplot2)
ggplot(dtf, aes(x=date,y=open, color = as.factor(year))) + geom_line()
ggplot(dtf, aes(x=plotdate,y=open, color = as.factor(year))) + geom_line()
ggplot(calendardays, aes(x=plotdate, y=mean)) + geom_line()

tqdm和Jinja2是我唯一的要求。我尝试指定版本,而不是单向指定错误。

似乎它试图在testpypi服务器上找到tqdm和Jinja2而没有找到它们(因为它们只能在常规pypi上使用)。将软件包上传到非测试服务器并运行pip install。

我需要在setup.py文件(下面)中添加什么才能在上传到testpypi时找到要求?

谢谢!

pip install -i https://testpypi.python.org/pypi poirot
Collecting poirot
  Downloading https://testpypi.python.org/packages/source/p/poirot/poirot-0.0.15.tar.gz
Collecting tqdm==3.4.0 (from poirot)
  Could not find a version that satisfies the requirement tqdm==3.4.0 (from poirot) (from versions: )
No matching distribution found for tqdm==3.4.0 (from poirot) 

2 个答案:

答案 0 :(得分:31)

尝试pip install --extra-index-url https://testpypi.python.org/pypi poirot

参见参考Installing Packages from Multiple Servers from One or More Requirements File

答案 1 :(得分:1)

在 2021 年 1 月尝试,已接受答案中的更新对我不起作用。这有效:

pip install -i https://test.pypi.org/pypi/ --extra-index-url https://pypi.org/simple <your_package_in_testpypi>

请注意,第一个网址是 test.pypi.org/pypi,第二个网址是 pypi.org/simple

他们的官方页面应该更新,其说明显示:

pip install -i https://test.pypi.org/simple/ <your_package_in_testpypi>

这不起作用。