我正在尝试在我的Ubuntu系统上安装一个Python包。我想通过一个我编写的安装脚本来安装它。setup.py脚本如下:
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'],
)
安装包会安装在 /usr/local/bin 目录中。但是,当我在 /usr/local/bin 之外导入模块时,会出现导入错误。我尝试将路径更改为 /usr/local/bin,这样可以完美地工作,而且不会出现导入错误。如何安装包,以便我可以在任何目录中导入模块?先感谢您...
/usr/local/bin
目录下了吗?你使用的是哪个命令来进行安装的? - Laur Ivan/usr/local/bin
时,就不会出现导入错误,我可以导入模块。 - abhay gurralasudo python setup.py install
安装这些包。 - abhay gurrala