2017-10-16 74 views
0

我是新來的PyPI,嘗試創建和上傳包,下面是目錄結構:的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='[email protected]', 
    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「目錄,不包含」mypackage「目錄。

任何人都可以告訴我這裏有什麼問題嗎?謝謝!

回答

0

你忘了,包括在setup任何Python代碼 - 無論是py_modulespackages

… 
packages=['mypackage'], 
…