べ断桥烟雨ミ
2019-10-14 11:55
采纳率: 100%
浏览 2.3k
已结题

如何创建一个带有指定版本Python和JupyterLab的环境?

  请问要如何在Anaconda中创建一个同时拥有Python 3.7.4与JupyterLab 1.1.4的环境?

  我在cmd中通过以下命令创建了一个Python 3.7.4环境:

D:\Anaconda3\envs>conda create -n dp python=3.7
WARNING: A directory already exists at the target location 'D:\Anaconda3\envs\dp'
but it is not a conda environment.
Continue creating environment (y/[n])? y

Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: D:\Anaconda3\envs\dp

  added / updated specs:
    - python=3.7


The following NEW packages will be INSTALLED:

  ca-certificates    anaconda/pkgs/main/win-64::ca-certificates-2019.8.28-0
  certifi            anaconda/pkgs/main/win-64::certifi-2019.9.11-py37_0
  openssl            anaconda/pkgs/main/win-64::openssl-1.1.1d-he774522_2
  pip                anaconda/pkgs/main/win-64::pip-19.2.3-py37_0
  python             anaconda/pkgs/main/win-64::python-3.7.4-h5263a28_0
  setuptools         anaconda/pkgs/main/win-64::setuptools-41.4.0-py37_0
  sqlite             anaconda/pkgs/main/win-64::sqlite-3.30.0-he774522_0
  vc                 anaconda/pkgs/main/win-64::vc-14.1-h0510ff6_4
  vs2015_runtime     anaconda/pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_0
  wheel              anaconda/pkgs/main/win-64::wheel-0.33.6-py37_0
  wincertstore       anaconda/pkgs/main/win-64::wincertstore-0.2-py37_0

  Python 3.7.4被成功安装,但当继续安装JupyterLab时,会出现以下问题:

D:\Anaconda3\envs>activate dp

D:\Anaconda3\envs>conda.bat activate dp

(dp) D:\Anaconda3\envs>conda install jupyterlab
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.

...

UnsatisfiableError: The following specifications were found to be incompatible with each other:



Package tornado conflicts for:
jupyterlab -> tornado[version='!=6.0.0,!=6.0.1,!=6.0.2']
Package jinja2 conflicts for:
jupyterlab -> jinja2[version='>=2.10']
Package notebook conflicts for:
jupyterlab -> notebook[version='>=4.3|>=4.3.1']
Package nodejs conflicts for:
jupyterlab -> nodejs[version='<10']
Package sqlite conflicts for:
python=3.7 -> sqlite[version='>=3.25.3,<4.0a0|>=3.26.0,<4.0a0|>=3.27.2,<4.0a0|>=3.28.0,<4.0a0|>=3.29.0,<4.0a0']
Package openssl conflicts for:
python=3.7 -> openssl[version='>=1.1.1a,<1.1.2a|>=1.1.1b,<1.1.2a|>=1.1.1c,<1.1.2a']
Package pip conflicts for:
python=3.7 -> pip
Package jupyterlab_launcher conflicts for:
jupyterlab -> jupyterlab_launcher[version='>=0.10.0,<0.11.0|>=0.11.0,<0.12.0|>=0.11.2,<0.12.0|>=0.13.1,<0.14.0|>=0.4.0|>=0.6.0,<0.7.0']
Package subprocess32 conflicts for:
jupyterlab -> subprocess32
Package futures conflicts for:
jupyterlab -> futures
Package jupyterlab_server conflicts for:
jupyterlab -> jupyterlab_server[version='>=0.2.0,<0.3.0|>=1.0.0,<2.0.0']
Package vc conflicts for:
python=3.7 -> vc[version='14.*|>=14.1,<15.0a0']

  这个是什么问题?如何解决?感觉默认的base环境很庞大,很多东西用不到。但想要使用JupyterLab又不得不安装……

  • 收藏

2条回答 默认 最新

  • jetable 2019-10-18 00:05
    已采纳

    用virtualenv试下呢,这个轻量,也稳定,至今没遇到问题

    打赏 评论
  • べ断桥烟雨ミ 2020-12-08 13:24

    Virtualenv 自身好像是不能指定 Python 版本的,它的原理是基于原始 Python 解释器创建并继承其环境并与全局进行隔离。这样可能要自己提前在全局安装多个 Python 解释器,使用对应的 Python 解释器调用 Virtualenv 去创建环境了。

    目前把 Anaconda3 卸掉了,换成了官方原装的 Python 3.7.9 ,用 Virtualenv + 清华源 挺好的。

    打赏 评论

相关推荐 更多相似问题