

 Amazon Redshift 將不再支援從修補程式 198 開始建立新的 Python UDFs。現有 Python UDF 將繼續正常運作至 2026 年 6 月 30 日。如需詳細資訊，請參閱[部落格文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# UDF 的 Python 語言支援
<a name="udf-python-language-support"></a>

您可以根據 Python 程式設計語言建立自訂 UDF。[Python 2.7 standard library](https://docs.python.org/2/library/index.html) 可供 UDF 使用，但下列模組除外：
+ ScrolledText
+ Tix
+ Tkinter
+ tk
+ turtle
+ smtpd

除了 Python 標準程式庫外，下列模組是 Amazon Redshift 實作的一部分：
+ [numpy 1.8.2](http://www.numpy.org/)
+ [pandas 0.14.1](https://pandas.pydata.org/)
+ [python-dateutil 2.2](https://dateutil.readthedocs.org/en/latest/)
+ [pytz 2014.7](https://pypi.org/project/pytz/2014.7/)
+ [scipy 0.12.1](https://www.scipy.org/)
+ [six 1.3.0](https://pypi.org/project/six/1.3.0/)
+ [wsgiref 0.1.2](https://pypi.python.org/pypi/wsgiref)

您也可以匯入自己的自訂 Python 模組，並執行 [CREATE LIBRARY](r_CREATE_LIBRARY.md) 命令，使它們可供 UDF 使用。如需詳細資訊，請參閱[範例：匯入自訂 Python 程式庫模組](udf-importing-custom-python-library-modules.md)。

**重要**  
Amazon Redshift 會透過 UDF 全面封鎖檔案系統的網路存取和寫入存取。

**注意**  
Python 3 不適用於 Python UDF。若要取得 Amazon Redshift UDF 的 Python 3 支援，請改用 [純量 Lambda UDF](udf-creating-a-lambda-sql-udf.md)。