重新安装 python 2.7.12 和 python 3.5.2
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42044346/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Reinstall python 2.7.12 and python 3.5.2
提问by Zero G
Good evening,
晚上好,
today i messed up my laptop trying to install some packages for python 3.5.2. I tried to install the correct pip version but i missed something and now i can't install any package in both versions and i can't solve the problem. Is it possible to unistall the 2 versions (including all packages) and reinstall everything? I don't use Python 2.7.12 (but i'l like to have a clean version of it), i need python 3.5.2 with the correct pip version to install, for example, the packages NumPy, SciPy, matplotlib etc.
今天我把我的笔记本电脑搞砸了,试图为 python 3.5.2 安装一些软件包。我试图安装正确的 pip 版本,但我错过了一些东西,现在我无法在两个版本中安装任何软件包,也无法解决问题。是否可以卸载 2 个版本(包括所有软件包)并重新安装所有内容?我不使用 Python 2.7.12(但我想要一个干净的版本),我需要安装正确的 pip 版本的 python 3.5.2,例如,包 NumPy、SciPy、matplotlib 等。
Thanks in advance,
提前致谢,
J
J
回答by Alex L
I'd highly recommend using virtualenv, and never modifying the system python, except to install pip and virtualenv if necessary.
我强烈建议使用 virtualenv,并且永远不要修改系统 python,除非必要时安装 pip 和 virtualenv。
As was alluded to above, many OSes count on having a working python2 in order to function.
正如上面提到的,许多操作系统都指望有一个有效的 python2 才能运行。
So...
所以...
apt-get remove python3
apt-get install python3
pip3 install virtualenv
virtualenv -p python3 venv
. venv/bin/activate
# now you are in a nice python3 world, completely isolated from system python
# remember to say . venv/bin/python every time you do anything
# or you can even add it to your .bashrc