📦 Installation Guide¶
System Requirements¶
Environment Requirements
- Python: 3.10 or higher
- Operating System: Windows, macOS, Linux
- Memory: Recommended 512MB+ available memory
Installation Methods¶
🚀 Install with pip (Recommended)¶
🔧 Install from Source¶
If you want to use the latest development version or participate in development:
Bash
# Clone repository
git clone https://github.com/271374667/EmailWidget.git
cd EmailWidget
# Install development dependencies
pip install -e ".[dev]"
Verify Installation¶
After installation, you can verify the installation was successful in the following ways:
1. Import Test¶
Python
try:
from email_widget import Email
from email_widget.widgets import TextWidget
print("✅ EmailWidget 安装成功!")
except ImportError as e:
print(f"❌ 安装失败: {e}")
2. Version Check¶
3. Create Test Email¶
Python
from email_widget import Email
from email_widget.widgets import TextWidget
from email_widget.core.enums import TextType
# 创建测试邮件
email = Email("安装测试")
email.add_widget(
TextWidget()
.set_content("EmailWidget 安装成功!🎉")
.set_type(TextType.TITLE_LARGE)
)
# 导出测试文件
file_path = email.export_html("installation_test.html")
print(f"测试文件已生成: {file_path}")
Optional Dependencies¶
Some features of EmailWidget require additional dependencies:
📊 Chart Features¶
If you need to use chart components (this content is installed on-demand, not included by default):
Common Issues¶
❓ Installation Failed?¶
❓ Charts Not Displaying Chinese Text Properly?¶
This is usually a font configuration issue:
Python
# 手动配置中文字体
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei', 'Microsoft YaHei']
plt.rcParams['axes.unicode_minus'] = False
EmailWidget will automatically handle this issue, but if problems persist, please check if Chinese fonts are installed on your system.
❓ Using in Jupyter Notebook¶
EmailWidget is fully compatible with Jupyter Notebook:
Python
from email_widget import Email
from email_widget.widgets import TextWidget
# 创建邮件
email = Email("Jupyter 测试")
email.add_widget(TextWidget().set_content("在 Jupyter 中使用 EmailWidget"))
# 预览 HTML(在 Jupyter 中直接显示)
from IPython.display import HTML
HTML(email.export_str())
Next Steps¶
After installation, you can:
- 📚 Create Your First Email - 5-minute quick start
- 📖 Understand Basic Concepts - Learn core concepts
- 💡 View Example Code - Learn practical usage
Need Help?
If you encounter any installation issues, please feel free to ask in GitHub Issues!