Bu eğitim, Aspose.Slides for Python’u .NET üzerinden çalıştırmak için python’un nasıl kurulacağına ilişkin ayrıntılı adımlar sunar. Microsoft Windows, macOS veya Linux tabanlı sistemlerin herhangi birinde yapılandırılmış .NET Framework’e sahip olduğunuz varsayılır ve Aspose.Slides kodunu Python’da çalıştırmak için gerekli tüm yazılımları yüklemeniz için size rehberlik eder. Bu adımlar sırasında Python’u kuracağız ve kurulan ortamı doğrulamak için yeni bir PPTX dosyası oluşturacağız.
Aspose.Slides for Python’u .NET üzerinden Çalıştırmak için Python Yükleme Adımları
- .NET çerçeve desteği ile yapılandırılmış bir Microsoft Windows, macOS veya Linux’a sahip olduğunuz varsayılmaktadır. Daha fazla bilgi için Install .NET on Windows, Linux, and macOS adresini ziyaret edebilirsiniz.
- Python uzantısını VS Koduna yükleyin
- Python 3.9.6‘i yükleyin
- Pip komutunu yükle
- Aspose.Slides for Python via .NET‘i yükleyin
- Bir PowerPoint dosyası oluşturmak için kod yazın ve Aspose.Slides for Python kodunu çalıştırın
İlk iki adımı karşılayan bir ortamınız varsa, bunları yok sayabilir ve sonraki komutları Linux, Windows veya macOS ortamınızdaki terminal veya komut isteminde çalıştırabilirsiniz. Aspose.Slides’ı kurmak için Python ve Pip3’ü kurmanız gerekir.
Aspose.Slides for Python’u .NET üzerinden Çalıştırmak için Python’u Yükleme Komut Dosyası
1. Install .NET Framework (Required for Ubuntu only) | |
#For Ubuntu | |
apt update | |
apt upgrade | |
apt install sudo | |
sudo apt update | |
sudo apt install wget | |
wget -q https://packages.microsoft.com/config/ubuntu/19.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb | |
sudo dpkg -i packages-microsoft-prod.deb | |
sudo apt-get update | |
sudo apt-get install apt-transport-https | |
sudo apt-get update | |
sudo apt-get install dotnet-sdk-3.1 | |
2. Install Python 3.9.6 | |
#For Ubuntu | |
sudo apt install -y python3.9 | |
# For MS Windows and macOS | |
install using MSI or DMG package. Be sure to select the check box to set the path during installation | |
3. Installing Pip Command | |
# For Ubuntu | |
sudo apt install python3-pip | |
# For Windows and Mac | |
python3 -m pip install --upgrade pip | |
4. Install Aspose.Slides | |
python3 -m pip install aspose-slides | |
# Additional requirements for Ubuntu to install libgdiplus and libc6-dev | |
# For Ubuntu only | |
apt-get update | |
apt-get install -y libgdiplus | |
cd /usr/lib && ln -s libgdiplus.so gdiplus.dll | |
apt-get install -y --no-install-recommends libc6-dev | |
5. Write Sample Program and save It As SamplePresentation.Py And Run Program | |
python3 SamplePresentation.py | |
import aspose.slides as slides | |
# Instantiate a Presentation object that represents a presentation file | |
with slides.Presentation() as presentation: | |
slide = presentation.slides[0] | |
slide.shapes.add_auto_shape(slides.ShapeType.LINE, 50, 150, 300, 0) | |
presentation.save("NewPresentation.pptx", slides.export.SaveFormat.PPTX) | |
6. Run the sample using following command | |
python3 SamplePresentation.py |
Halihazırda .NET, Python 3.9.6 ve PIP ortam kurulumunuz varsa, API’yi kullanmak için 4. Adımdan ve sonrasından başlayabilirsiniz. Eski Python2.x yerine API ile Python 3.9.6 kullanılması önerilir.
Kurulumu doğrulamak için API’yi kullanan çalışan bir temel örnek kod da verilmiştir. API kullanarak üretmek istediğiniz farklı örnekleri üretmek için diğer örnekleri deneyebilir ve API özelliklerini keşfedebilirsiniz.