python上传包到私有源 和下载安装 - xd21303/Notebook GitHub Wiki

上传

新增~/.pypirc文件。

[distutils]
index-servers =
  internal

[internal]
repository: http://60.60.60.70:3141
username: admin
password: password

在源代码文件夹下新增setup.py

from setuptools import setup,find_packages

setup(
    name="k2tf",
    packages=find_packages(),
    package_data = {
            'health_model':['data/column_max_value.csv','model/*.h5']},
    version='1.0.0',
    description="keras model to tensorflow",
    author="Amir H. Abdi",
    author_email='[email protected]',
    url="https://github.com/amir-abdi/keras_to_tensorflow",
    download_url='https://github.com/amir-abdi/keras_to_tensorflow/blob/master/keras_to_tensorflow.py',
    keywords=['keras', 'tensorflow', 'model'],
    classifiers=[],
    entry_points={
        'console_scripts': [
        'command1 = advisorhelper.cmdline:execute'
        'command2 = adviserserver.create_algorithm:run',
        'command3 = adviserserver.run_algorithm:run'
    ]
    },
    install_requires=[
        'argparse',
    ]
)

新增setup.cfg

[bdist_wheel]
  universal=1

上传包到私有源

python setup.py bdist_wheel upload -r internal

上传之前可以做一个检查

python setup.py sdist check

下载安装包

pip install k2tf -i http://60.60.60.70:3141 --trusted-host 60.60.60.70

pip 下加入多个源

修改~/.pip/pip.conf文件

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
extra-index-url= http://60.60.60.70:3141/simple