简体   繁体   中英

Install python package into directory relative to site-packages

I have a Python package that is one of a collection of company Python packages. When I run

python setup.py install

I want the package to be installed to a common company directory, along with other company packages. I want this directory to be relative to the default Python install directory, eg,

/usr/lib/python2.7/site-packages/<company_name>/<python_package_name>

That is, I want to insert <company_name> into the installation path at install time.

I've seen ways to prefix this path, but can't seem to work out how to do what I've described.

Unfortunately Python packaging doesn't work like that. You could probably bend it to work like that but that would be quite an effort for a person without experience in Python packaging and even for experienced persons the amount/output tradeoff would not make sense. You do not mention any motive to do this besides your personal preference.

Instead, to have well-managed and human-navigable package installation folder, I recommend you to study the following resources

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM