ezoic

Saturday, July 29, 2017

How to build and use python package.

 e.

distutils is a python standard package. It helps people to package, etc.

For example, we have a directory, and we have three files there, foo.py, bar.py, setup.py

And setup.py has the following content:

from distutils.core import setup
setup(
    name='fooBar',
    version='1.0',
    author='Will',
    author_email='wilber@sh.com',
    url='http://www.cnblogs.com/wilber2013/',
    py_modules=['foo', 'bar'],
)


 We  run python setup.py sdist in that directory. And we will have a package named fooBar-1.0.zip.

And we can unzip the file, and "python setup.py install", and we can use "foo" , "bar" the two packages. 

need to use  "sudo chown -R $USER /usr/local/lib/python2.7"           when run python setup.py install, otherwise permission denied. 


No comments:

Post a Comment

looking for a man

 I am a mid aged woman. I live in southern california.  I was born in 1980. I do not have any kid. no compliacted dating.  I am looking for ...