我正在创建一个conda env并指定我要在其中包含python 3.6:
$ export PYTHON_VERSION=3.6
$ source ~/virtualenv/python2.7/bin/activate
$ python --version
Python 2.7.14
$ pip --version
pip 9.0.1 from /home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages (python 2.7)
$ wget -q http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
$ chmod +x miniconda.sh
$ ./miniconda.sh -b -p /home/travis/miniconda
$ export PATH=/home/travis/miniconda/bin:$PATH
$ conda update --yes --quiet conda
$ conda env create --file environment.yml python=${PYTHON_VERSION}
但是,此安装python 2.7:
conda env create --file environment.yml python=${PYTHON_VERSION}
Fetching package metadata ...........
Solving package specifications: .
... omitting some packages here
python-2.7.16- 100% |################################| Time: 0:00:00 74.39 MB/s
... omitting some other packages
这是environment.yml:
name: my-env
dependencies:
- ipython
- numpy>=1.12
- seaborn>=0.7
- scipy>=0.18.0
- matplotlib>=2.0.0
- Cython>=0.26
- scikit-learn>=0.20.1
- tqdm
- nose
- numpydoc
- pytest
- pytest-cov
- pip:
- "https://api.github.com/repos/choldgraf/download/zipball/master"
这是怎么回事?以及如何强加正确版本的python?
答案 0 :(得分:1)
编辑:将所需的python版本添加到environment.yaml
中可下载并安装所需的python版本。
name: my-env
dependencies:
- python=3.6.8
- ipython
- numpy>=1.12
- seaborn>=0.7
- scipy>=0.18.0
- matplotlib>=2.0.0
- Cython>=0.26
- scikit-learn>=0.20.1
- tqdm
- nose
- numpydoc
- pytest
- pytest-cov
- pip:
- "https://api.github.com/repos/choldgraf/download/zipball/master"
OR
conda install --name my-env python=${PYTHON_VERSION}
environment.yaml
更新环境
conda env update --file environment.yaml
的原因是,̶M̶i̶n̶i̶c̶o̶n̶d̶a̶.̶s̶h̶下载为Python 2的建立和不Python 3的 ̶
您想获得̶M̶i̶n̶i̶c̶o̶n̶d̶a̶3̶.̶s̶h̶从https:̶/̶/̶r̶e̶p̶o̶.̶c̶o̶n̶t̶i̶n̶u̶u̶m̶.̶i̶o̶/̶m̶i̶n̶i̶c̶o̶n̶d̶a̶/̶M̶i̶n̶i̶c̶o̶n̶d̶a̶3̶-最新-LINUX-̶x̶8̶6̶_̶6̶4̶.̶s̶h̶.̶ ̶
̶H̶o̶p̶e̶̶t̶h̶i̶s̶̶h̶e̶l̶p̶s̶.̶ ̶
编辑:̶我认为这将设立̶M̶i̶n̶i̶c̶o̶n̶d̶a̶与Python̶3̶.̶7̶.̶需要手动创建3.6环境与命令康达创建̶-̶-NAME̶p̶y̶t̶h̶o̶n̶3̶6̶PYTHON =̶3̶.̶6̶.̶8̶.̶ ̶
̶Y̶o̶u̶̶c̶a̶n̶̶r̶e̶a̶d̶̶m̶o̶r̶e̶̶a̶b̶o̶u̶t̶̶c̶o̶n̶d̶a̶̶e̶n̶v̶i̶r̶o̶n̶m̶e̶n̶t̶s̶̶h̶e̶r̶ ̶