[root@pypi-server ~]# useradd pypi
[root@pypi-server ~]# mkdir /usr/local/pypi/packages -p # 创建一个pypi存放python代码的目录
[root@pypi-server ~]# chown pypi.pypi /usr/local/pypi -R
[root@pypi-server ~]# cd /usr/local/pypi/packages/
[root@pypi-server packages]# vim setup.py
from setuptools import setup
setup(
name='maytest',
version='0.0.1',
packages=['maytest']
)
[root@pypi-server ~]# pypi-server -p 8080 /usr/local/pypi/packages/ # 加上&就可以后台启动了
192.168.57.1 - - [14/Jul/2020 03:56:17] "GET / HTTP/1.1" 200 1017
192.168.57.1 - - [14/Jul/2020 03:56:17] "GET /favicon.ico HTTP/1.1" 404 718
# 浏览器访问192.168.57.123:8080,就会显示如下的界面,pypi服务启动成功
Welcome to pypiserver!
This is a PyPI compatible package index serving 0 packages.
To use this server with pip, run the following command:
pip install --index-url http://192.168.57.123:8080/simple/ PACKAGE [PACKAGE2...]
To use this server with easy_install, run the following command:
easy_install --index-url http://192.168.57.123:8080/simple/ PACKAGE [PACKAGE2...]
The complete list of all packages can be found here or via the simple index.
This instance is running version 1.3.2 of the pypiserver software.