赞
踩
https://download.pytorch.org/whl/torch_stable.html
https://download.pytorch.org/whl/cpu/torch-1.6.0-cp38-none-macosx_10_9_x86_64.whl
pip install pyenv
或者:
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
添加环境变量:
- ╭─nile@nilematoiMac ~/virtualenv_wk
- ╰─$ vim ~/.zshrc
- #pyenv
-
- export PYENV_ROOT="$HOME/.pyenv"
- export PATH="$PYENV_ROOT/bin:$PATH"
- eval "$(pyenv init -)"
-
- ╭─nile@nilematoiMac ~/virtualenv_wk
- ╰─$ source ~/.zshrc
安装python3.8.5
由于官方源太慢,修改国内源
- ─nile@nilematoiMac ~/.pyenv/plugins/python-build/share/python-build ‹master*›
- ╰─$ vim 3.8.5
- #require_gcc
- prefer_openssl11
- export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
- install_package "openssl-1.1.0j" "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0j.tar.gz#31bec6c203ce1a8e93d5994f4ed304c63ccf07676118b6634edded12ad1b3246" mac_openssl --if has_broken_mac_openssl
- install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
- if has_tar_xz_support; then
- install_package "Python-3.8.5" "https://npm.taobao.org/mirrors/python/3.8.5/Python-3.8.5.tar.xz#e3003ed57db17e617acb382b0cade29a248c6026b1bd8aad1f976e9af66a83b0" ldflags_dirs standard verify_py38 copy_python_gdb ensurepip
- else
- install_package "Python-3.8.5" "https://npm.taobao.org/mirrors/python/3.8.5/Python-3.8.5.tgz#015115023c382eb6ab83d512762fe3c5502fa0c6c52ffebc4831c4e1a06ffc49" ldflags_dirs standard verify_py38 copy_python_gdb ensurepip
https://www.python.org/ftp/python/
替换为:
https://npm.taobao.org/mirrors/python/
- ╭─nile@nilematoiMac ~/.pyenv/plugins/python-build/share/python-build ‹master*›
- ╰─$ pyenv versions
- * system (set by /Users/nile/.pyenv/version)
- 2.7.14
- 3.8.5
在3.8.5版本下安装
- pyenv shell 3.8.5
- pip install virtualenv -i https://mirrors.aliyun.com/pypi/simple/
- pip install virtualenvwrapper -i https://mirrors.aliyun.com/pypi/simple/
source ~/.pyenv/versions/3.8.5/bin/virtualenvwrapper.sh
- ╭─nile@nilematoiMacmkvirtualenv pytorch
- ╭─nile@nilematoiMac ~/virtualenv_wk
- ╰─$ lsvirtualenv -b
- pytorch
- ╭─nile@nilematoiMac ~/virtualenv_wk
- ╰─$ workon pytorch
- (pytorch) ╭─nile@nilematoiMac ~/virtualenv_wk
- ╰─$
pip install torch-1.6.0-cp38-none-macosx_10_9_x86_64.whl -i https://mirrors.aliyun.com/pypi/simple/
pip install torchvision -i https://mirrors.aliyun.com/pypi/simple/
- (pytorch) ╭─nile@nilematoiMac ~/virtualenv_wk
- ╰─$ python
- Python 3.8.5 (default, Aug 19 2020, 23:39:26)
- [Clang 9.0.0 (clang-900.0.39.2)] on darwin
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import torch
- >>>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。