You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

工作电脑中pandas/numpy等Python包被组策略(AppLocker)阻止的解决方案咨询

Fix "Blocked by Group Policy" for pandas/numpy with AppLocker

First, let's break down why this is happening: AppLocker restricts execution of specific file types (like .pyd Python compiled extensions or .dll files), and pandas/numpy rely heavily on these binary components—unlike pypyodbc which might be pure Python or use already-allowed binaries.

Here's exactly what you need to ask your IT team to unblock, no need to open up the entire site-packages folder:

1. Use Windows Event Viewer to get the EXACT blocked file paths (most reliable method)

This is the best way to avoid guesswork:

  • Run your failing script (e.g., import pandas)
  • Open Event Viewer → Navigate to Applications and Services Logs > Microsoft > Windows > AppLocker > EXE and DLL
  • Look for events with Event ID 8004—this will explicitly list the full path of the file that was blocked by AppLocker. Copy these paths directly and send them to IT.

2. If you can't access Event Viewer, specify these targeted paths

If you need to pre-emptively list the likely culprits, focus on the compiled binary files in pandas and numpy's directories:

  • For numpy: Unblock all .pyd and .dll files under the numpy/core and numpy/lib subdirectories. Example path rules for AppLocker:
    • %USERPROFILE%\AppData\Local\Programs\Python\PythonXX\Lib\site-packages\numpy\**\*.pyd
    • %USERPROFILE%\AppData\Local\Programs\Python\PythonXX\Lib\site-packages\numpy\**\*.dll
  • For pandas: Unblock all .pyd files under the pandas/_libs subdirectory. Example path rules:
    • %USERPROFILE%\AppData\Local\Programs\Python\PythonXX\Lib\site-packages\pandas\**\*.pyd
  • Note: Replace PythonXX with your Python version (e.g., Python310) and adjust the base path if you're using a system-wide Python install (e.g., C:\Program Files\PythonXX\Lib\site-packages\... instead of the user profile path).

3. Why this works instead of unblocking all site-packages

AppLocker operates on file execution rules—pandas and numpy use compiled binary extensions (.pyd) that act like mini-executables, which are being blocked. By targeting only these specific subdirectories and file types, you minimize the security exposure while solving your issue.

内容的提问来源于stack exchange,提问作者acausedelle

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 17:12:52