python - 如何使用 pip 安装 python 多包项目?
问题描述
我的项目结构是:
.
├── LICENSE.txt
├── mochgir
│ ├── conf
│ │ ├── consts.py
│ │ ├── font
│ │ │ ├── __init__.py
│ │ │ └── Tahoma.ttf
│ │ └── __init__.py
│ ├── __init__.py
│ └── mochgir.py
├── README.md
└── setup.py
项目代码在mochgir
文件夹(包)中。
这是我的 setup.py:
from setuptools import setup
setup(
name='Mochgir',
version='0.68',
license='MIT',
url='https://www.github.com/javadmokhtari/github',
description='Translate and Analyze docx documents',
author='Javad Mokhtari Koushyar',
packages=(
'mochgir',
'mochgir.conf',
'mochgir.conf.font'
),
include_package_data=True,
zip_safe=False,
python_requires='>=3.0',
install_requires=[
'requests==2.19.1',
'python-docx==0.8.6',
'google==2.0.1',
'reportlab==3.4.0'
]
)
我为 pip 打包它所做的工作:
root@me:~/mm# python3 setup.py sdist bdist_wheel
root@me:~/mm# twine upload --repository-url https://test.pypi.org/legacy/ dist/*
root@me:~/mm# twine upload dist/*
到目前为止一切正常。但安装后我不能像这样使用我的包:
from mochgir import Translate
from mochgir import Analyze
from conf.consts import *
我唯一能做的就是:
import mochgir
甚至上面的代码也不行,它只是一个模块,里面没有我的任何代码。
那么,怎么了?
解决方案
推荐阅读
- nexmo - NEXMO:通过 NCCO 拒绝来电的正确方法
- python - 如何修复“ValueError:查看限制最小值 -36881.6 小于 1 并且是无效的 Matplotlib 日期值。”?
- angular - Angular 9 或 10 + Angular Material 10:导入无法解析为 NgModule 类
- pine-script - pow() 不适用于变量指数 1/N(第 N 个根)
- x86 - 如何编写一个引导扇区,从它所在的 USB 记忆棒读取数据?
- r - 在表函数中嵌入子集
- python - 查找具有所需范围内的值的连续行
- python - 用于查找两个时间戳变量之间差异的任何 Python 代码
- javascript - 如何在不使用分隔符(split())的情况下从字符串中获取数组,只是为了获取整个字符串并将其转换为数组类型?
- python - 如何在 Python 中组合两个不平衡列表中的两个字典?