python - sudo easy_install pip 不工作
问题描述
我sudo easy_install pip
在我的 mac 上执行命令时遇到问题。我不在防火墙后面。我正在使用 python 版本 2.7.10。macOS Sierra 的版本是 10.12.4。这是我收到的错误:
Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) -- Some packages may not be found!
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')
解决方案
我找到了一个brew
用于安装的解决方案pyenv
。在这里找到了解决方案,但我只需要使用pip
.
# Install PyEnv (https://github.com/pyenv/pyenv#installation)
$ brew update
$ brew install pyenv
# Initialize pyenv using bash_profile
$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi\nexport PATH="~/.pyenv/bin:$PATH"' >> ~/.bash_profile
# or using zshrc
$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi\nexport PATH="~/.pyenv/bin:$PATH"' >> ~/.zshrc
# restart the shell
$ exec "$SHELL"
# Install Python 2.7
$ pyenv install 2.7.14
$ pyenv local 2.7.14
完成这些步骤后,我又跑sudo easy_install pip
了,尤里卡!有效。
推荐阅读
- node.js - centos7,为什么我不能在我的服务器上安装express?
- mysql - 从三个表中选择数据,其中显示第一个表行中的所有记录,水平显示另一个表的所有重复项
- python - 使用 one-hot 编码器转换日期数据帧
- javascript - 单击 div 外部隐藏在 Angular js 中
- node.js - 节点服务命令返回空响应
- java - 在spring批处理JdbcBatchItemWriter中添加多个更新查询
- java - 构造函数重载 - Java 中的最佳实践
- oracle - 警告:在 pl/sql 中创建触发器时已编译但编译错误?
- python - Python:从布尔数组中获取最后 n 个 True
- postgresql - 在 PostgreSQL 9.6 中自动真空/真空不释放死行