conda无法安装python=3.7的虚拟环境:
conda create -n py37 python=3.7
(base) ➜ AzurLaneAutoScript git:(master) conda create -n alas python==3.7.6 -y
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- python==3.7.6
Current channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/osx-arm64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
- https://repo.anaconda.com/pkgs/main/osx-arm64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-arm64
- https://repo.anaconda.com/pkgs/r/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.
(base) ➜ AzurLaneAutoScript git:(master) conda search --full --name python
Loading channels: done
# Name Version Build Channel
python 3.8.11 hbdb9e5c_5 pkgs/main
python 3.8.13 hbdb9e5c_0 pkgs/main
python 3.8.13 hbdb9e5c_1 pkgs/main
python 3.8.15 h266c4f5_0 pkgs/main
python 3.8.15 hc0d8a6c_2 pkgs/main
python 3.9.6 hc70090a_5 pkgs/main
python 3.9.7 hc70090a_1 pkgs/main
python 3.9.11 hbdb9e5c_1 pkgs/main
python 3.9.11 hbdb9e5c_2 pkgs/main
python 3.9.12 hbdb9e5c_0 pkgs/main
python 3.9.12 hbdb9e5c_1 pkgs/main
python 3.9.13 hbdb9e5c_1 pkgs/main
python 3.9.13 hbdb9e5c_2 pkgs/main
python 3.9.15 hbdb9e5c_0 pkgs/main
python 3.9.15 hc0d8a6c_2 pkgs/main
python 3.10.0 hbdb9e5c_1 pkgs/main
python 3.10.0 hbdb9e5c_2 pkgs/main
python 3.10.0 hbdb9e5c_3 pkgs/main
python 3.10.0 hbdb9e5c_5 pkgs/main
python 3.10.3 hbdb9e5c_5 pkgs/main
python 3.10.4 hbdb9e5c_0 pkgs/main
python 3.10.6 hbdb9e5c_0 pkgs/main
python 3.10.6 hbdb9e5c_1 pkgs/main
python 3.10.8 hbdb9e5c_0 pkgs/main
python 3.10.8 hc0d8a6c_1 pkgs/main
发现channel中最低版本为3.8.11
根据Stackoverflow上面的问题:https://stackoverflow.com/questions/70205633/cannot-install-python-3-7-on-osx-arm64
以及CSDN问答:https://ask.csdn.net/questions/7631935
原因应该是(机翻):
当Apple Silicon投放市场时,Python 3.8已经发布了大约一年的时间,因此用于osx-arm64的Python 3.7构建从来不是Conda Forge常规构建矩阵的一部分。
在Apple Silicon系统上使用3.7的直接替代方法是使用Rosetta模拟x86_64,或者使用容器系统,例如Docker。
长期来看,您可以尝试请求python-feedstock包含osx-arm64的3.7版本。然而,从技术上讲,3.7.12(2021年9月)是最终的特性版本,现在已经进入了仅维护阶段(参见PEP 537)。此外,其他构建特定于python版本的变体的包不会为osx-arm64构建,因此即使有python=3.7,这些包也不会在那里(至少不会通过Conda)。基本上,我不认为有人会接受这个。
用罗赛塔转换成X86架构来运行这个。
## 创建一个空的环境
conda create -n py37
## 启动该环境
conda activate py37
## 使用x86_64 architecture channel(s)
conda config --env --set subdir osx-64
## 安装python3.7之类的操作 install python, numpy, etc. (add more packages here...)
conda install python=3.7
(base) ➜ AzurLaneAutoScript git:(master) conda create -n alas
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 22.9.0
latest version: 22.11.0
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: /Users/yuki/opt/anaconda3/envs/alas
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate alas
#
# To deactivate an active environment, use
#
# $ conda deactivate
Retrieving notices: ...working... done
(base) ➜ AzurLaneAutoScript git:(master) conda activas alas
CommandNotFoundError: No command 'conda activas'.
Did you mean 'conda activate'?
(base) ➜ AzurLaneAutoScript git:(master) conda activate alas
(alas) ➜ AzurLaneAutoScript git:(master) conda config --env --set subdir osx-64
(alas) ➜ AzurLaneAutoScript git:(master) conda install python=3.7.6
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 22.9.0
latest version: 22.11.0
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: /Users/yuki/opt/anaconda3/envs/alas
added / updated specs:
- python=3.7.6
The following packages will be downloaded:
package | build
---------------------------|-----------------
ca-certificates-2022.10.11 | hecd8cb5_0 125 KB defaults
certifi-2022.9.24 | py37hecd8cb5_0 155 KB defaults
libcxx-14.0.6 | h9765a3e_0 968 KB defaults
libedit-3.1.20210910 | hca72f7f_0 139 KB defaults
libffi-3.2.1 | 1 37 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
ncurses-6.3 | hca72f7f_3 857 KB defaults
openssl-1.1.1s | hca72f7f_0 2.8 MB defaults
pip-22.2.2 | py37hecd8cb5_0 2.3 MB defaults
python-3.7.6 | h359304d_2 19.8 MB defaults
readline-7.0 | h1de35cc_5 316 KB defaults
setuptools-65.5.0 | py37hecd8cb5_0 1.1 MB defaults
sqlite-3.33.0 | hffcf06c_0 1.3 MB defaults
tk-8.6.11 | h7bc2e8c_0 3.0 MB defaults
xz-5.2.8 | h6c40b1e_0 262 KB defaults
zlib-1.2.11 | 0 98 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
------------------------------------------------------------
Total: 33.2 MB
The following NEW packages will be INSTALLED:
ca-certificates pkgs/main/osx-64::ca-certificates-2022.10.11-hecd8cb5_0 None
certifi pkgs/main/osx-64::certifi-2022.9.24-py37hecd8cb5_0 None
libcxx pkgs/main/osx-64::libcxx-14.0.6-h9765a3e_0 None
libedit pkgs/main/osx-64::libedit-3.1.20210910-hca72f7f_0 None
libffi anaconda/pkgs/free/osx-64::libffi-3.2.1-1 None
ncurses pkgs/main/osx-64::ncurses-6.3-hca72f7f_3 None
openssl pkgs/main/osx-64::openssl-1.1.1s-hca72f7f_0 None
pip pkgs/main/osx-64::pip-22.2.2-py37hecd8cb5_0 None
python pkgs/main/osx-64::python-3.7.6-h359304d_2 None
readline pkgs/main/osx-64::readline-7.0-h1de35cc_5 None
setuptools pkgs/main/osx-64::setuptools-65.5.0-py37hecd8cb5_0 None
sqlite pkgs/main/osx-64::sqlite-3.33.0-hffcf06c_0 None
tk pkgs/main/osx-64::tk-8.6.11-h7bc2e8c_0 None
wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0 None
xz pkgs/main/osx-64::xz-5.2.8-h6c40b1e_0 None
zlib anaconda/pkgs/free/osx-64::zlib-1.2.11-0 None
Proceed ([y]/n)? y
Downloading and Extracting Packages
libedit-3.1.20210910 | 139 KB | ############################################################################################################## | 100%
xz-5.2.8 | 262 KB | ############################################################################################################## | 100%
readline-7.0 | 316 KB | ############################################################################################################## | 100%
certifi-2022.9.24 | 155 KB | ############################################################################################################## | 100%
python-3.7.6 | 19.8 MB | ############################################################################################################## | 100%
ca-certificates-2022 | 125 KB | ############################################################################################################## | 100%
tk-8.6.11 | 3.0 MB | ############################################################################################################## | 100%
libffi-3.2.1 | 37 KB | ############################################################################################################## | 100%
sqlite-3.33.0 | 1.3 MB | ############################################################################################################## | 100%
zlib-1.2.11 | 98 KB | ############################################################################################################## | 100%
pip-22.2.2 | 2.3 MB | ############################################################################################################## | 100%
libcxx-14.0.6 | 968 KB | ############################################################################################################## | 100%
ncurses-6.3 | 857 KB | ############################################################################################################## | 100%
setuptools-65.5.0 | 1.1 MB | ############################################################################################################## | 100%
openssl-1.1.1s | 2.8 MB | ############################################################################################################## | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Retrieving notices: ...working... done