Pypi上载问题:必须是有效的Python标识符

2024-04-26 09:46:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我上传我的包到pypi时遇到了问题。我以前只能使用python setup.py sdist upload -r pypi,但现在这会导致一个错误:

Upload failed (400): requires: Must be a valid Python identifier.
error: Upload failed (400): requires: Must be a valid Python identifier.

我尝试了一些方法来让它工作,但都失败了,出现了同样的错误。你知道吗

我删除了根目录中当前的distbuildegg文件夹。然后我增加了我的软件包版本号1微版本。我确保了我的~/.pypirc文件符合说明:

[distutils]
index-servers = 
    pypi


[pypi]
username: c.welsh2
password: ...

并更新了piptwinesetuptools。我使用

python setuptools.py bdist_wheel 

它在/package_root/dist/*中创建了构建,我尝试使用

twine upload dist/*

我再次得到:

HTTPError: 400 Client Error: requires: Must be a valid Python identifier. for url: https://upload.pypi.org/legacy/

有人知道是什么导致了这个问题吗?你知道吗

为了完整起见,这里是我的安装文件:

from distutils.core import setup
import  setuptools 


#version
MAJOR = 4
MINOR = 0
MICRO = 5

#=======
__version__ = '%d.%d.%d' % (MAJOR, MINOR, MICRO)

setup(
  name = 'PyCoTools',
  packages = ['PyCoTools'], # this must be the same as the name above
  version = __version__,
  description = 'A python toolbox for COPASI',
  author = 'Ciaran Welsh',
  requires=['lxml','argparse','pandas','numpy','scipy','matplotlib.pyplot','scipy','seaborn','sklearn'],
  package_data={'PyCoTools':['*.py','Documentation/*.pdf',
                             'logging_config.conf',
                             'Documentation/*.html','Licence.txt',
                             'ReadMe.md',
                             'Examples/KholodenkoExample/*',
                             'Examples/BioModelsWorkflowVersion1/*',
                             'Scripts/*.py',
                             'Tests/*.py',
                             'Tests/*.cps',
                             'PyCoToolsTutorial/*.pickle',
                             'PyCoToolsTutorial/*.py',
                             'PyCoToolsTutorial/*.ipynb',
                             'PyCoToolsTutorial/*.html',
                             'PyCoToolsTutorial/*.cps']},
  author_email = '--<hidden>',
  ##
  url = 'https://pypi.python.org/pypi/PyCoTools',
  keywords = ['systems biology','modelling','biological',
              'networks','copasi','identifiability analysis','profile likelihood'],
  license='GPL4',
  install_requires=['pandas','numpy','scipy','matplotlib',
                    'lxml'],
  long_description='''Tools for using Copasi via Python and calculating profile likelihoods. See Github page and documentation for more details''')

Tags: pypypiforversiondistsetupbesetuptools