use*_*742 19 python virtualenv okta pipenv python-3.8
我正在使用 Python 和 okta-aws 工具,为了在 aws 上获取正确的凭据,我需要运行 okta-aws init。但是收到错误信息,Could not read roles from Okta系统提示"Your Pipfile requires python_version 3.7, but you are using 3.8.3 (/usr/local/Cellar/o/1.1.4/l/.venv/bin/python)。
我已经尝试在 mac 上搜索所有的 Pipfile,似乎我~/Pipfile和/usr/local/Cellar/python@3.8/3.8.3_2/libexec/bin/Pipfile所有下的 Pipflie都具有相同的 3.8 版本的 python,而我下的 Pipfile /usr/local/Cellar/okta-aws-tools/1.1.4/libexec/Pipfile有required python_version = 3.7.
我已经为此苦苦挣扎了一段时间,真的不知道如何解决这个问题。
Sha*_*yan 67
考虑pyenv在 macOS上使用 Homebrew安装
brew update
brew install pyenv
Run Code Online (Sandbox Code Playgroud)
或克隆存储库以获取最新版本的pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
Run Code Online (Sandbox Code Playgroud)
定义环境变量
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)
重新启动您的 shell 以使路径更改生效
exec "$SHELL"
Run Code Online (Sandbox Code Playgroud)
验证安装并检查可用python版本
pyenv install --list
Run Code Online (Sandbox Code Playgroud)
安装所需python版本
pyenv install 3.7
Run Code Online (Sandbox Code Playgroud)
安装后将其设置为您的全球版本
pyenv global 3.7
Run Code Online (Sandbox Code Playgroud)
验证python系统正在使用的当前版本
python3 --version
Run Code Online (Sandbox Code Playgroud)
我建议你安装和使用pyenv,一个 Python 版本管理。安装pyenv后,安装python 3.7:
pyenv install 3.7
Run Code Online (Sandbox Code Playgroud)
然后将环境设置为PYENV_VERSION您要使用的 python 版本,在这种情况下将是3.7:
pyenv shell 3.7
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
71075 次 |
| 最近记录: |