背景:
mac本身自带python2.7,我安装了conda来管理python的各种安装包,后来想安装python3就是安装不上。报错如下:
$ conda install python3
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- python3
Current channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/osx-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/osx-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/free/osx-64
- https://repo.anaconda.com/pkgs/free/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/pro/osx-64
- https://repo.anaconda.com/pkgs/pro/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
网上查一下说是需要创建一个channel,方法如下:
$ conda config --append channels conda-forge
$ conda install python3
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- python3
Current channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/osx-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/osx-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/free/osx-64
- https://repo.anaconda.com/pkgs/free/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/pro/osx-64
- https://repo.anaconda.com/pkgs/pro/noarch
- https://conda.anaconda.org/conda-forge/osx-64
- https://conda.anaconda.org/conda-forge/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
还是报错,并且比之前还多了两行报错的内容。接下来一步,说是搜索一下python3相关的安装包:
$ anaconda search -t conda skimage
Using Anaconda API: https://api.anaconda.org
Packages:
Name | Version | Package Types | Platforms | Builds
------------------------- | ------ | --------------- | --------------- | ----------
DavidMertz/accelerate-skimage | 0.1.0 | conda | linux-64, osx-64, win-64 | py27_3, py35_3, py27_1, py35_1
Found 1 packages
Run 'anaconda show ' to get installation details
wangzhenzhudeMacBook-Pro:~ wangzhenzhu$ anaconda search -t conda python3
Using Anaconda API: https://api.anaconda.org
Packages:
Name | Version | Package Types | Platforms | Builds
------------------------- | ------ | --------------- | --------------- | ----------
ActivisionGameScience/avro-python3 | 1.8.2 | conda | linux-64 | py36_0, py35_0
: Avro is a serialization and RPC framework.
Carta/antlr4-python3-runtime | 4.7 | conda | linux-64, osx-64 | py36_0, py36h6e0042a_0
: ANTLR 4.7 runtime for Python 3.4.0
Carta/python3-saml | 1.2.6 | conda | linux-64, osx-64 | py36h7aca7d9_0, py36h47e814f_0
: Onelogin Python Toolkit. Add SAML support to your Python software using this library
HCC/cif2cell-python3 | 1.2.10 | conda | linux-64 | py36_0, py35_0
: CIF2Cell is a tool to generate the geometrical setup for various electronic structure codes from a CIF (Crystallographic Information Framework) file.
NSIDC/dnspython3 | 1.15.0 | conda | linux-64 | py35_0
asmeurer/robotframework-python3 | 2.8.4 | conda | osx-64 | py26_0, py27_0
: Python 3 compatible generic test automation framework
auto/bitcoin-python3 | 0.3.1 | conda | linux-64, linux-32 | py27_0
: http://laanwj.github.com/bitcoin-python/doc/
auto/caniusepython3 | 2.0.3 | conda | linux-64, linux-32 | py27_0
: https://github.com/brettcannon/caniusepython3
auto/python3-keybinder | 1.1.2 | conda | linux-64 | py27_0
: https://github.com/LiuLang/python3-keybinder
auto/python3-openid | 3.0.4 | conda | linux-64 | py27_0
: http://github.com/necaris/python3-openid
auto/python3-xlib | 0.14 | conda | linux-64 | py27_0
: https://github.com/LiuLang/python3-xlib
bioconda/avro-python3 | 1.8.2 | conda | linux-64, osx-64 | py36_1, py36_0, py35_1, py35_0, py34_0
: Avro is a serialization and RPC framework.
certik/antlr4-python3-runtime | 4.7.1 | conda | linux-64 | py37_0
: ANTLR 4.7.1 runtime for Python 3.6.3
conda-forge/python3-openid | 3.1.0 | conda | linux-64, win-32, win-64, osx-64 | py36_1001, py37_1001, py34_0, py36_1, py36_0, py35_0
hargup/python3-ldap | | conda | linux-64 | py27_0
: A strictly RFC 4511 conforming LDAP V3 pure Python 3 client - Python 2 compatible
hinterlistig/antlr4-python3-runtime | 4.5 | conda | win-64 | py34_0
: ANTLR 4.5 runtime for Python 3.4.0
intel/intelpython3_core | 2019.1 | conda | linux-64, win-64, osx-64 | 1, 0, 3, 2
intel/intelpython3_full | 2019.1 | conda | linux-64, osx-64, win-64 | 1, 0, 2
jlou/katas-p99-python3 | 0.1.0 | conda | osx-64 | py27heb3aba9_0, py27hd40701a_0
: Short description
kcleung/antlr4-python3-runtime | 4.5 | conda | osx-64 | py34_0
: ANTLR 4.5 runtime for Python 3.4.0
leif/avro-python3 | 1.7.7 | conda | linux-64 | py33_0, py35_0, py34_0
: Avro is a serialization and RPC framework.
lfortran/antlr4-python3-runtime | 4.7.1 | conda | linux-64 | py36_0
: ANTLR 4.7.1 runtime for Python 3.6.3
mhworth/python3-saml | 1.2.6 | conda | linux-64, osx-64 | py37_0, py36_0, py36h06348bb_0, py36h47e814f_0
rscohn2/intelpython3_examples | 1 | conda | linux-64 | intel
userzimmermann/robotframework-python3 | 2.8.4 | conda | linux-64 | py33_0, py34_0
: Python 3 compatible generic test automation framework
Found 25 packages
Run 'anaconda show ' to get installation details
展示下要安装的python包:
$ anaconda show conda-forge/python3-openid
Using Anaconda API: https://api.anaconda.org
Name: python3-openid
Summary:
Access: public
Package Types: conda
Versions:
+ 3.0.10
+ 3.1.0
To install this package with conda run:
conda install --channel https://conda.anaconda.org/conda-forge python3-openid
$ conda install --channel https://conda.anaconda.org/conda-forge python3-openid
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- ipaddress
- python3-openid
Use "conda info " to see the dependencies for each package.
wangzhenzhudeMacBook-Pro:~ wangzhenzhu$ conda install --channel https://conda.anaconda.org/conda-forge leif/avro-python3
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- leif/avro-python3
Current channels:
- https://conda.anaconda.org/conda-forge/osx-64
- https://conda.anaconda.org/conda-forge/noarch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/osx-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/osx-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/free/osx-64
- https://repo.anaconda.com/pkgs/free/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/pro/osx-64
- https://repo.anaconda.com/pkgs/pro/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
还是报错,,,Google到了这个方法:https://stackoverflow.com/questions/48589141/anaconda-unsatisfiableerror-the-following-specifications-were-found-to-be-in,好用。能安装上了python3。
解决方法:
1.终端输入:
$ conda create -n my_pymc_env python=3.5
显示结果:
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.5.13
latest version: 4.6.7
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: /Users/wangzhenzhu/anaconda2/envs/my_pymc_env
added / updated specs:
- python=3.5
The following packages will be downloaded:
package | build
---------------------------|-----------------
readline-6.2 | 2 274 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
wheel-0.29.0 | py35_0 82 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
pip-9.0.1 | py35_1 1.7 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
python-3.5.4 | 0 11.6 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
zlib-1.2.11 | 0 98 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
certifi-2016.2.28 | py35_0 211 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
tk-8.5.18 | 0 1.9 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
setuptools-36.4.0 | py35_1 566 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
sqlite-3.13.0 | 0 1.4 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
xz-5.2.3 | 0 225 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
------------------------------------------------------------
Total: 18.0 MB
The following NEW packages will be INSTALLED:
certifi: 2016.2.28-py35_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
openssl: 1.0.2l-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
pip: 9.0.1-py35_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
python: 3.5.4-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
readline: 6.2-2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
setuptools: 36.4.0-py35_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
sqlite: 3.13.0-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
tk: 8.5.18-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
wheel: 0.29.0-py35_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
xz: 5.2.3-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
zlib: 1.2.11-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
Proceed ([y]/n)? conda update -n base conda
Invalid choice: conda update -n base conda
Proceed ([y]/n)? y
Downloading and Extracting Packages
readline-6.2 | 274 KB | ################################################################################################### | 100%
wheel-0.29.0 | 82 KB | ################################################################################################### | 100%
pip-9.0.1 | 1.7 MB | ################################################################################################### | 100%
python-3.5.4 | 11.6 MB | ############################################################################################################ | 100%
zlib-1.2.11 | 98 KB | ############################################################################################################ | 100%
certifi-2016.2.28 | 211 KB | ############################################################################################################ | 100%
tk-8.5.18 | 1.9 MB | ############################################################################################################ | 100%
setuptools-36.4.0 | 566 KB | ############################################################################################################ | 100%
sqlite-3.13.0 | 1.4 MB | ############################################################################################################ | 100%
xz-5.2.3 | 225 KB | ############################################################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use:
# > source activate my_pymc_env
#
# To deactivate an active environment, use:
# > source deactivate
#
这个的功能好像是创建一个channel,这样就能安装上python3.
$ source activate my_pymc_env
这里面有个trick,就是第一行最前面,(my_pymc_env)这个是刚创建的channel,在这个通道下我们可以运行python3;另外新打开一个bash,不会有(my_pymc_env),在默认通道,并且输入:$ python 后,打开的还是python2.7.
deactivate #结束