Bu öğretici, python’u Aspose.Words for Python’u .NET aracılığıyla çalıştırmak için nasıl kuracağınıza 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ğunuzu varsayar ve Aspose.Words kodunu Python’da çalıştırmak için gereken tüm gerekli yazılımları kurmanız için size rehberlik eder. Bu adımlar sırasında Python’u kuracak ve kurulan ortamı doğrulamak için yeni bir DOCX dosyası oluşturacaksınız.
Aspose.Words for Python’u .NET aracılığıyla Çalıştırmak için Python’u Kurma Adımları
- .NET çerçeve desteğiyle yapılandırılmış bir Microsoft Windows, macOS veya Linux’a sahip olduğunuz varsayılır. Daha fazla bilgi için Install .NET on Windows, Linux, and macOS adresini ziyaret edebilirsiniz.
- Python 3.9.6 yükleyin
- Pip komutunu yükle
- Pip kullanarak Aspose.Words for Python via .NET yükleyin
- Bir Word dosyası oluşturmak için Aspose.Words for Python kodunu yazın ve çalıştırın
İlk iki adımı karşılayan bir ortamınız varsa, bunları yok sayabilir ve sonraki komutları terminalde veya Linux, Windows veya macOS ortamınızdaki komut isteminde yürütebilirsiniz. Aspose.Words’ü kurmak için Python ve Pip3’ü kurmanız gerekir.
Aspose.Words for Python’u .NET aracılığıyla Çalıştırmak için Python’u Kurmak İçin 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 | |
2. Installing Pip Command | |
# For Ubuntu | |
sudo apt install python3-pip | |
# For Windows and Mac | |
python3 -m pip install --upgrade pip | |
3. Install Aspose.Words | |
python3 -m pip install aspose-words | |
# 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 | |
4. Write Sample Program and save It As SampleWord.Py And Run Program | |
python3 SampleWord.py | |
import aspose.words as aw | |
doc = aw.Document() | |
builder = aw.DocumentBuilder(doc) | |
builder.write("Hello world!") | |
doc.save("c:\\words\\out.docx") | |
5. Run the sample using following command | |
python3 SampleWord.py |
Halihazırda .NET, Python 3.9.6 ve PIP ortamı kurulumunuz varsa, API’yi kullanmak için 4. Adımdan itibaren başlayabilirsiniz. API ile eski Python2.x yerine 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.