离线模式下Anaconda创建Python3.5环境报错原因咨询
Hey there, let's break down why you're hitting that error when trying to set up a Python 3.5 environment offline with Conda, and how to fix it.
First, let's recap the error you encountered:
Fetching package metadata ... Solving package specifications: . PackageNotFoundError: Package not found: '' Package missing in current linux-64 channels: - python 3.5*
Why this happens
- Offline mode only uses local cached packages: When you add the
--offlineflag, Conda completely stops reaching out to remote channels. It can only pull packages from your local cache (usually stored in~/anaconda3/pkgsor~/miniconda3/pkgs). If you never downloaded the Python 3.5 (linux-64) package and its dependencies while online, Conda has nothing to pull from locally. - The
anacondaspec adds more requirements: Includinganacondain your command tells Conda to install the full Anaconda distribution stack. Even if you had Python 3.5 cached, you might be missing other dependent packages that come with the full Anaconda setup.
Step-by-step fixes
Download all required packages while online first
Before switching to offline mode, run this command to download every package needed for your environment (without actually creating it yet):conda create -n py35 python=3.5 anaconda --download-onlyThis will pull Python 3.5 and all associated Anaconda packages for your linux-64 system, storing them directly in your Conda package cache.
Double-check your local cache
Head to your Conda packages directory to confirm the Python 3.5 package exists. Look for files named likepython-3.5.*-linux-64.tar.bz2in:~/anaconda3/pkgs # Use ~/miniconda3/pkgs if you're using MinicondaCreate the environment offline
Now that all necessary packages are cached, re-run your original offline command—it should work smoothly this time:conda create -n py35 python=3.5 anaconda --offlineAlternative: Opt for a minimal environment (if full Anaconda isn't needed)
If you don't require the entire Anaconda distribution, you can create a leaner environment first (fewer packages to cache):# Download minimal packages online conda create -n py35 python=3.5 --download-only # Create environment offline conda create -n py35 python=3.5 --offlineYou can always add specific packages later (as long as you've cached them) using
conda install <package-name> --offline.
内容的提问来源于stack exchange,提问作者HISI

