我在github上有一个公共python项目。这只是为了在Windows上运行。 我想将它添加到PyPI中,使人们可以通过在pypi上从github提供python包
pip install mypackage
安装它的存在来存储我在GitHub上包,而不是使用AWS S3存储的方法吗? 如果是,如何? 我也需要知道预期的格式是什么。 我是否应该制作一个包文件夹,并将mypackage-1.0.tar.gz放入其中,尽管这是为了Windows?
我已经读完了这一点:http://docs.python-guide.org/en/latest/shipping/packaging/
到目前为止,当我运行 PIP安装https://github.com/my_username/mypackage 我得到这个错误:
Downloading from URL https://github.com/my_username/mypackage Cleaning up... Exception: Traceback (most recent call last): File "C:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\basecommand.py", line 122, in main status = self.run(options, args) File "C:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\commands\install.py", line 278, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "C:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\req.py", line 1197, in prepare_files do_download, File "C:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\req.py", line 1375, in unpack_url self.session, File "C:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\download.py", line 582, in unpack_http_url unpack_file(temp_location, location, content_type, link) File "C:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\util.py", line 627, in unpack_file and is_svn_page(file_contents(filename))): File "C:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\util.py", line 210, in file_contents return fp.read().decode('utf-8') File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte
我也想通了,我必须写setup.py和setup.cfg然后我可以运行
python setup.py build
python setup.py register
>>Registering mypackage to http://pypi.python.org/pypi
>>Server response (401): basic auth failed
我不知道为什么注册失败。 也试过:
python setup.py sdist register upload
这抱怨为: PyPi issues - Upload failed (401): You must be identified to edit package information 但是创建.pypirc并没有解决问题。 任何想法如何让我的包添加到pypi?