为什么 Mac 适合编程? | 您所在的位置:网站首页 › 编程用macbook好吗 › 为什么 Mac 适合编程? |
pyenv 安装# 安装 pyenv 参考, http://einverne.github.io/post/2017/04/pyenv.htmlcurl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash # 添加环境变量vim ~/.zshrcexport PATH="HOME/.pyenv/bin:HOME/.pyenv/bin:HOME/.pyenv/bin:PATH"eval "(pyenvinit¨E45E)"eval"(pyenv init -)"eval "(pyenvinit¨E45E)"eval"(pyenv virtualenv-init -)" # 常用命令 # 查看可用版本pyenv install -l # 安装 python2 最新版本pyenv install 2.7.16 # 安装报错 ERROR: The Python zlib extension was not compiled. Missing the zlib? https://github.com/pyenv/pyenv/wiki/common-build-problemsbrew install readline xz # When running Mojave or higher (10.14+) you will also need to install the additional SDK headers by downloading them from Apple Developers. You can also check under /Library/Developer/CommandLineTools/Packages/ as some versions of Mac OS will have the pkg locally.sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / # 安装 python3 最新版本 3.7.2# 报错 ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?# https://github.com/pyenv/pyenv/issues/1184#issuecomment-409320318CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)" pyenv install 3.7.2 # 安装 python 3.6 ,tf 支持的最新版本pyenv install 3.6.8 # 安装 python2 最新版 2.7.16pyenv install 2.7.16 # 创建虚拟环境pyenv virtualenv 3.6.4 env-3.6.4 # 激活虚拟环境pyenv activate env-3.6.4 # 退出虚拟环境pyenv deactivate 创建 pip 配置文件# 创建 pip 配置目录mkdir ~/.pip# 编辑配置vim ~/.pip/.pip.conf # 添加以下内容[list]format=columns[global]download_cache = ~/.cache/pipindex-url = http://mirrors.aliyun.com/pypi/simple/[install]trusted-host=http://mirrors.aliyun.com |
CopyRight 2018-2019 实验室设备网 版权所有 |