我是pypi的新手,尝试创建并上传包,以下是目录结构:
mypackage
-- README.rst
-- LICENSE.txt
-- MANIFEST.in
-- setup.py
mypackage
-- file1.py
-- __init__.py
setup.py如下:
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='mypackage',
version='0.0.1',
description='test package',
long_description=long_description,
url='https://github.com/xxxxx/test',
author='xxx',
author_email='xxx@gmail.com',
license='MIT',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
],
)
我跑:
python setup.py sdist bdist_wheel
twine upload dist/*
我可以看到mypackage在pypi上,并且有:
mypackage-0.0.1-py3-none-any.whl (md5)
mypackage-0.0.1.tar.gz (md5)
然后我在我的机器上运行:“pip install mypackage”,它说“已成功安装mypackage-0.0.1”,但在python_directory \ Lib \ site-packages下,只有“mypackage-0.0.1.dist-” info“directory,no”mypackage“目录。
任何人都可以告诉我这里有什么问题?谢谢!
答案 0 :(得分:0)
您忘记在setup
中添加任何Python代码 - py_modules
或packages
:
…
packages=['mypackage'],
…