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

在虚拟环境中安装Jupyter Notebook遇到问题

Fixing Pip Cache Permission Issues When Installing Jupyter Notebook in Python 3.5 Virtual Environment

That error pops up because the pip cache directory (or its parent) isn’t owned by your current user, so pip can’t access it and disables caching—this often breaks installation workflows. Here are a few straightforward fixes to get past this:

Solution 1: Take Ownership of the Pip Cache Directory

This permanently resolves the permission issue for all future pip commands. Run this in your terminal:

sudo chown -R $(whoami) ~/Library/Caches/pip
  • sudo grants admin rights to modify directory ownership
  • $(whoami) automatically inserts your current username, so you don’t have to type it manually
  • -R applies the ownership change to every file and subfolder inside the pip cache directory

Solution 2: Bypass the Cache Temporarily

If you don’t want to adjust directory permissions, tell pip to skip using the cache entirely for these install steps:

  1. Upgrade pip first without cache:
    python3 -m pip install --upgrade pip --no-cache-dir
    
  2. Then install Jupyter Notebook the same way:
    python3 -m pip install jupyter --no-cache-dir
    

Solution 3: Use a Custom Cache Directory

You can specify a new cache folder that you definitely own (like one in your home directory) for pip to use:

  1. Create the custom cache folder if it doesn’t exist:
    mkdir -p ~/my_pip_cache
    
  2. Run your pip commands with this directory set as the cache:
    PIP_CACHE_DIR=~/my_pip_cache python3 -m pip install --upgrade pip
    PIP_CACHE_DIR=~/my_pip_cache python3 -m pip install jupyter
    

This redirects pip to use your new folder instead of the problematic system cache.

After trying any of these solutions, your pip install commands should run without that permission error.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 11:11:33