2017-07-07 52 views
1

我也跟着上載包的PyPI的官方文檔,以及在PyPI中自述文件中提供的信息,但每次我得到一個HTTP 400錯誤:400錯誤:無效的URI上傳新的PyPI包時(合股)

$ twine upload dist/* 
Uploading distributions to https://upload.pypi.org/legacy/ 
Enter your username: bradaallen 
Enter your password: 
Uploading brad_nlp_helpers-0.1.1-py3-none-any.whl 
HTTPError: 400 Client Error: home_page: Invalid URI for url: 
https://upload.pypi.org/legacy/ 

我使用了〜/ .pypirc

[distutils] 
index-servers = 
    pypi 
    pypitest 

[pypi] 
username=bradaallen 
password=[password] 

[pypitest] 
username=bradaallen 
password=[password] 

對於包,我使用twine version 1.9.1 (pkginfo: 1.4.1, requests: 2.12.4, setuptools: 27.2.0, requests-toolbelt: 0.8.0, tqdm: 4.14.0)

當我使用python setup.py sdist bdist_wheel upload我得到了同樣的問題:

Submitting dist\brad_nlp_helpers-0.1.1.tar.gz to 
https://upload.pypi.org/legacy/ Upload failed (400): home_page: Invalid URI 
error: Upload failed (400): home_page: Invalid URI 

我沒有指定存儲庫,因爲這是上傳時API給出的建議。我在PyPI建議的鏈接上看到一個404 error,並且沒有看到我應該使用的替代網站!

這是我的第一個包,我不是在互聯網上的其他地方看到此錯誤。任何想法重新:發生了什麼?

+0

我剛剛訪問過的頁面https://upload.pypi.org/legacy/並得到錯誤404(不存在)。你使用什麼版本的「麻線」?可能你需要創建'.pypirc'?... – phd

+1

嗨@phd - 感謝您的評論。我更新了我使用的twine和.pypirc數據的版本。我也注意到該網站不存在 - 它是由PyPI API推薦的URL。我沒有在其他地方看到這個問題,這讓我懷疑這是PyPI最近的一個問題。思考? –

+0

不知道。我在15年前創建了'.pypirc',並且一直很高興地使用'python setup.py upload'。 :-))) – phd

回答

0

就在幾分鐘前嘗試上傳一個包,並得到了這個問題。 :-)要解決:升級pipsetuptoolstwine到最新版本:

pip install -U pip setuptools twine 

刪除或從~/.pypirc註釋掉庫:

[distutils] 
index-servers = 
    pypi 

[pypi] 
#repository: 
username: … 

twine upload現在的作品!

+0

嗨@phd - 非常感謝您繼續爲此提供幫助! :)當我在我的Mac和Win7機器上運行'pip install -U pip setuptools twine'時,我得到這個錯誤:'OSError:[Errno 2]沒有這樣的文件或目錄:'/ Users/bradaallen/anaconda/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg''我*不會*如果我分別升級3個軟件包會得到這個錯誤 - 但我也被告知每個軟件包都是「最新的日期「,我得到了與我原來的帖子相同的錯誤。思考? –

+0

在'/ Users/bradaallen/anaconda/lib/python2.7/site-packages /'中搜索'* .pth'文件並刪除(註釋掉)提及的'setu ptools-27.2.0-py2.7. egg'。現在setu ptools 27已經有點老了。 – phd

0

驚人。我還將此作爲問題發佈在Twine's GitHub page上。

原來在setup.py文件的URL應該對應的代碼被託管在哪裏(這是有道理的)。我把我的個人網站作爲網址,我想倉庫的單元測試正在拒絕我......現在已經上傳了。

再次謝謝@phd!

相關問題