所以,我的问题非常很简单,如何在 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 来启动。
