我创建了一个python应用程序并打包了所有使用过的setup.py
。我的问题是在python setup.py install
我的库中出现/usr/local/lib/python2.7/dist-packages
但是我无法在新闻Python应用程序中导入它。
编辑:
我有一个setup.py文件
from setuptools import setup
from codecs import open
from os import path
import wheel
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='package',
version='0.1.1',
packages=['package', 'package.subpackage'],
license='GPLv3',
long_description=long_description,
scripts=['start'],
zip_safe=False,
classifiers=['Operating System :: Unix',
'License :: OSI Approved :: GNU General Public'
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 2.7.12',
)
我跑的时候
python setup.py sdist bdist_wheel
python setup.py install
我在/usr/local/lib/python2.7/dist-packages/
上有一个名为package-version-py2.7.egg/
的新目录,但是当我打开python并写from package import *
时,python返回错误
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named package