Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install a python package to /usr/local/bin?

I am trying to install a python package on my ubuntu.I am trying to install it through a setup script which i had written.The setup.py script looks like this:

    from setuptools import setup

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

setup(
    name = 'pyduino',
    description = 'PyDuino project aims to make python interactive with hardware particularly arduino.',
    url = '###',
    keywords = 'python arduino',
    author = '###',
    author_email = '###',
    version = '0.0.0',
    license = 'GNU',
    packages = ['pyduino'],
    install_requires = ['pyserial'],
    classifiers = [

        # How mature is this project? Common values are
        #   3 - Alpha
        #   4 - Beta
        #   5 - Production/Stable
        'Development Status :: 3 - Alpha',
        'Intended Audience :: Developers',
        'Topic :: Software Development :: Build Tools', 
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
    ],
    scripts=['pyduino/pyduino.py'],
)

Package installs in /usr/local/bin directory.But when I am importing the modules outside the /usr/local/bin,import error occurs.I tried changing path to /usr/local/bin and it works perfectly and import error doesn't occur.How can I install the package so that I can import the modules in any directory? Thanks in advance...

like image 374
abhay gurrala Avatar asked Sep 19 '25 02:09

abhay gurrala


1 Answers

Try install your packages with pip using this

pip install --install-option="--prefix=$PREFIX_PATH" package_name

as described here Install a Python package into a different directory using pip? and i'll suggest to read what are 1. pip 2. virtualenv

Good luck :)

EDIT: i found the package is installed with pip like:

pip install --install-option="--prefix=/usr/local/bin" pyduino_mk
like image 146
Miro Rodozov Avatar answered Sep 20 '25 16:09

Miro Rodozov