【发布时间】:2016-02-14 05:42:15
【问题描述】:
所以,我的问题非常很简单,如何在 Debian 8 上安装带有 pip 的 Python 3.5,没有出现像 ImportError: cannot import name 'HTTPSHandler' 这样的错误?
【问题讨论】:
所以,我的问题非常很简单,如何在 Debian 8 上安装带有 pip 的 Python 3.5,没有出现像 ImportError: cannot import name 'HTTPSHandler' 这样的错误?
【问题讨论】:
到目前为止,我发现在 Linux 上安装 Python(尽管我没有尝试过 Debian 8)最简单的方法是使用 Python 发行版 Miniconda。
# Assuming you want 64bit
cd ~
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda-latest-Linux-x86_64.sh
# Agree to the license agreement and where to put it
# Add it to your $PATH
# Assuming you use bash (You might have to change this if my memory isn't correct...)
echo 'export PATH="~/miniconda3/bin:$PATH"' >> ~/.bashrc
# reload your .bashrc
source ~/.bashrc
# make sure it works
python --version # should print out 3.5
# install something with pip
pip install pyperclip # or anything
# make sure it works
python -c 'import pyperclip'
现在您可以使用 pip。不过对于像numpy等复杂的二进制包,Miniconda还自带了一个叫conda的工具。如果您需要,conda --help 或 google 应该可以帮助您开始这条路线。
如果您需要卸载 Miniconda,只需删除 ~/miniconda3 并从您的 ~/.bashrc 中删除上面提到的 PATH 行
另外,如果你有足够的空间,并且想要很多“正常工作”的预安装包,他们也会发布Anaconda python。
如果你不使用终端,Anaconda 提供了一个不错的 IDE,Spyder,可以通过在终端输入 spyder 来启动。
【讨论】: