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

Django 2.1.5安装遇pytz依赖超时,本地安装后仍报错求助

Fixing Django 2.1.5 Installation Error After Manual pytz Install

It looks like the issue here is that your manually installed pytz isn't accessible in the Django virtual environment you created, and pip is still trying to fetch dependencies from PyPI even when you re-run the install steps. Let's break down how to fix this:

Step 1: Install pytz in the correct virtual environment

The pytz you installed earlier was added to your system-level Python, not the isolated virtual environment for Django. Here's how to install it in the right place:

  • Activate your Django virtual environment first:
    source /u01/django/bin/activate
    
  • Now use the virtual environment's pip to install your local pytz package:
    pip install /u01/pytz-2018.9
    
    (Once the virtual env is activated, pip points to /u01/django/bin/pip3, so you don't need to specify the full path.)

Step 2: Install Django without fetching remote dependencies

When using pip install -e (editable mode), pip will still attempt to resolve and download dependencies from PyPI by default—even if you've already installed them locally. To skip this and use the pytz you just installed in the virtual env:

  • Make sure your virtual environment is still active, then run:
    pip install -e /u01/Django-2.1.5 --no-deps
    
    The --no-deps flag tells pip not to check for or download any required dependencies, since you've already handled pytz manually.

Step 3: Verify the installation

To confirm everything worked, run this command (with the virtual env active):

python -m django --version

You should see 2.1.5 printed if the installation was successful.

Why your previous attempt failed

  • You installed pytz using your system's pip3 (from /u01/Python-3.7.2/bin), which doesn't affect the isolated virtual environment at /u01/django. Virtual environments don't inherit packages from the system Python unless explicitly configured to do so.
  • Even if you had installed pytz in the virtual env, the default pip install -e command would still try to reach PyPI to validate dependency versions, which was failing due to your connection timeout. The --no-deps flag bypasses this check.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.11 09:06:24