我已经向 pypi 发布了一个名为“surrealism”的模块,它可以生成超现实的句子和错误消息。它包含一个 SQLite3 数据库,其中包含我的模块所需的所有单词和句子。
以下所有安装方法都可以正常工作:
python setup.py 安装
pip 安装超现实主义
easy_install 超现实主义
并且模块工作正常。
但是,当安装到 virtualenv 中时,会出现问题。surrealism.py 安装到C:\Users\me\virtualenvs\surrealism\Lib\site-packages,但surrealism.sqlite没有安装?
如果我运行 python 并尝试导入模块,我的模块会在C:\Users\me\virtualenvs\surrealism创建一个名为surrealism.sqlite的新 sqlite3 数据库
我的 setup.py 的内容如下:
#!/usr/bin/env python
from setuptools import setup
long_desc = open('readme.rst').read()
setup(name = 'surrealism',
version = '0.5.2',
py_modules = ['surrealism'],
author = 'Morrolan',
author_email = 'morrolan@icloud.com',
url = 'https://github.com/Morrolan/surrealism',
license = 'GNU General Public License (GPL)',
description = 'Surreal sentence and error message generator.',
long_description = long_desc,
platforms = ['Windows','Unix','OS X'],
download_url = "https://pypi.python.org/pypi/surrealism/",
keywords = ["surreal", "surrealism", "error message"],
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Development Status :: 4 - Beta",
"Environment :: Other Environment",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: OS Independent",
"Topic :: Education",
"Topic :: Software Development :: Libraries :: Python Modules",
],
install_requires=['setuptools'],
)
在 surrealism.py 中,我以相当基本的方式引用/连接到 SQLite3 数据库:
CONN = sqlite3.connect('surrealism.sqlite')
但到目前为止,它还没有给我带来任何问题。
有没有更明确的方法来引用 surrealism.sqlite,还是我必须在 setup.py 中指定一些东西来强制安装?
亲切的问候,莫罗兰