当我尝试在测试网站上注册我的包时,为什么会发生以下情况?它注册常规网站就好了:/
当我尝试在pypi测试站点注册时,我的命令行会发生这种情况:
PS C:\Users\Dave\Desktop\distributing\hellodmt2Distribution> python setup.py register -r https://testpypi.python.org
i
running register
running egg_info
writing hellodmt2.egg-info\PKG-INFO
writing top-level names to hellodmt2.egg-info\top_level.txt
writing dependency_links to hellodmt2.egg-info\dependency_links.txt
reading manifest file 'hellodmt2.egg-info\SOURCES.txt'
writing manifest file 'hellodmt2.egg-info\SOURCES.txt'
Traceback (most recent call last):
File "setup.py", line 14, in <module>
download_url = "https://github.com/dmt257/hellodmt2/archive/0.1.tar.gz",
File "C:\Python27\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\setuptools\command\register.py", line 10, in run
orig.register.run(self)
File "C:\Python27\lib\distutils\command\register.py", line 46, in run
self._set_config()
File "C:\Python27\lib\distutils\command\register.py", line 81, in _set_config
raise ValueError('%s not found in .pypirc' % self.repository)
ValueError: https://testpypi.python.org/pypi not found in .pypirc
PS C:\Users\Dave\Desktop\distributing\hellodmt2Distribution>
我的setup.py:
#!/usr/bin/env
try:
from setuptools import setup
except importError:
from distutils.core import setup
setup(name = "hellodmt2",
description = "a source distribution test",
version = "0.1",
author = "David",
author_email = "dmt257257@gmail.com",
py_modules = ["hellodmt2"],
url = "https://github.com/dmt257/hellodmt2",
download_url = "https://github.com/dmt257/hellodmt2/archive/0.1.zip",
keywords = ["testing"],
)
这是我的pypirc:
[distutils]
index-servers=
pypi
pypitest
[pypitest]
repository = https://testpypi.python.org/pypi
username = dmt257
password = mypasswordhere
[pypi]
repository = https://pypi.python.org/pypi
username = dmt257
password = mypasswordhere
答案 0 :(得分:1)
应该调用该文件,只需.pypirc
,而不是pypi.pypirc
。这是一种常用于配置文件的Linux风格的文件名。前导点表示它不会显示在正常的目录列表中。
根据我的阅读,Linux $Home
目录(~
)的Windows等效项为C\Users\<logged-in-user>
,所以C\Users\Dave
就是你的情况。将位置添加到PATH
不会有帮助;此变量仅允许Windows查找可执行文件。
文档不清楚此文件在Windows环境中的位置,有一个旧的bug提到在Windows中找不到此文件,因为缺少{{1} } envorinment变量。它已被修复&#39;但除了HOME
之外,它还不清楚文件应该去哪里。
我首先尝试重命名您的文件。如果您仍然遇到问题,请尝试将其移至您的主页&#39;目录。请注意,Windows GUI不允许您仅使用扩展名重命名文件,因此您必须从命令窗口执行此操作:
~/.pypirc