C:\Users\xxx\Desktop\python-sdk>python setup.py install running install running bdist_egg running egg_info writing demo.egg-info\PKG-INFO writing dependency_links to demo.egg-info\dependency_links.txt writing top-level names to demo.egg-info\top_level.txt reading manifest file 'demo.egg-info\SOURCES.txt' writing manifest file 'demo.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib running build_py creating build\bdist.win-amd64\egg creating build\bdist.win-amd64\egg\Demo copying build\lib\Demo\__init__.py -> build\bdist.win-amd64\egg\Demo byte-compiling build\bdist.win-amd64\egg\Demo\__init__.py to __init__.cpython-37.pyc creating build\bdist.win-amd64\egg\EGG-INFO copying demo.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO copying demo.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO copying demo.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO copying demo.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO zip_safe flag not set; analyzing archive contents... creating 'dist\demo-0.1-py3.7.egg' and adding 'build\bdist.win-amd64\egg' to it removing 'build\bdist.win-amd64\egg' (and everything under it) Processing demo-0.1-py3.7.egg Removing e:\app\python\python37\lib\site-packages\demo-0.1-py3.7.egg Copying demo-0.1-py3.7.egg to e:\app\python\python37\lib\site-packages demo 0.1 is already the active version in easy-install.pth
Installed e:\app\python\python37\lib\site-packages\demo-0.1-py3.7.egg Processing dependencies for demo==0.1 Finished processing dependencies for demo==0.1
进入到Python解释器并执行包中的函数如下:
1 2 3 4 5 6 7
C:\Users\xxx\Desktop\python-sdk>python Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import Demo >>> Demo.say_hello() hello! >>>
卸载包使用pip uninstall命令即可:
1 2 3 4 5 6 7
C:\Users\xxx\Desktop\python-sdk>pip uninstall Demo Found existing installation: Demo 0.1 Uninstalling demo-0.1: Would remove: e:\app\python\python37\lib\site-packages\demo-0.1-py3.7.egg Proceed (y/n)? y Successfully uninstalled bscp-config-0.1