请教,ubuntu python 2.7.1110.04下,如何卸载python2.7.8

我的Ubuntu 16.04 怎么还是 Python 2.7.11_百度知道
我的Ubuntu 16.04 怎么还是 Python 2.7.11
14:26) [GCC 5; exit()***@****; or &quot:~$ python3Python 3.&gt, Mar 30 2016;&gt.1+ (copyright&quot, Apr 17 2016, &:~$ pythonPython 2:29) [GCC 5; credits&.11+ (help&quot:46;&gt:00;help& or &quot, && for more information.3;.7;license&quot.5;license&quot, &quot.3;&credits&quot, 22;.&gt.1 ] on linux2Type &copyright&quot, &quot.1 ] on linuxType & exit()16***@****
其他类似问题
为您推荐:
python的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁说解64位的ubuntu14.10系统如何安装python2.7.9-python-Php教程-壹聚教程网说解64位的ubuntu14.10系统如何安装python2.7.9
本文是笔者整理的64位的ubuntu14.10系统安装python2.7.9详细步骤,虽然ubuntu14.10系统下默认安装了python2.7.8和python3.4.2,但是我们还是可以多熟练一下安装环境,这样对以后的学习更加得心应手一点。
ubuntu14.10系统下默认安装了python2.7.8和python3.4.2, 她们在/usr/bin/下可以找到, 默认用python2.7.8
xx@ada:~$ python --version&
Python 2.7.8&
xx@ada:~$ python3.4 --version&
Python 3.4.2&
xx@ada:~$ python2.7 --version&
Python 2.7.8&
xx@ada:~$ which python&
/usr/bin/python&
xx@ada:~$ which python3.4&
/usr/bin/python3.4&
xx@ada:~$&&
现在python官网出了python2.7系列的python2.7.9, 好了, 现在我们尝试着安装python2.7.9
python在ubuntu下有几种安装方法:
通过ubuntu官方的apt工具包安装
通过PPA(Personal Package Archive) 的apt工具包安装
通过编译python源代码安装
通过ubuntu官方的apt工具包安装
sudo apt-get install python2.7&
sudo apt-get install python3.4&
安装完成后, 可以用下面的命令进行确认
xx@ada:~$ python2.7 --version&
Python 2.7.8&
xx@ada:~$ python3.4 --version&
Python 3.4.2&
xx@ada:~$&&
从PPA(Personal Package Archives) 安装apt工具包
$ sudo apt-get install python-software-properties&
$ sudo add-apt-repository ppa:fkrull/deadsnakes&
$ sudo apt-get update&
$ sudo apt-get install python2.7&
类似使用apt工具包安装python的工具虽然简单, 但有时不一定能够安装到最新版本。因此, 在python出现重要更新时, 我们最好学会以从源代码直接编译安装python2.7.
从源代码编译安装python
$ wget -c htt://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz&
$ tar -xzvf Python-2.7.9.tgz&
$ cd Python-2.7.9/&
$ LDFLAGS=&-L/usr/lib/x86_64-linux-gnu& ./configure&
$ sudo make install&&
其中, 上面的wget -c (url)是下载命令,参数-c表示支持断点下载, url是目标的绝对路径 
&-L/usr/lib/x86_64-linux-gnu&中的x86_64-linux-gnu在/usr/lib/下可以找到, 这是x86_64可以看出我的系统是64的, 这里根据自己的系统进行键入。
好了, 安装完后我们检测下, 终端键入python --version, 回车, 再键入which python
xx@ada:~$ python --version&
Python 2.7.9&
xx@ada:~$ which python&
/usr/local/bin/python&
xx@ada:~$&&
可见, python2.7.9安装成功, 并且发现我们默认的python版本变成了python2.7.9。这是因为操作系统在搜索命令时, 是按照PATH环境变量的顺序依次进行搜索的, 
/usr/local/bin/下的python会比/usr/bin/下的python优先搜索到, 并作为默认的python版本。
那么我ubuntu14.10下就有三个版本的python,分别是python2.7.8, python2.7.9, python3.4.2, 如下:
xx@ada:~$ python --version&
Python 2.7.9&
xx@ada:~$ python2.7 --version&
Python 2.7.9&
xx@ada:~$ python3.4 --version&
Python 3.4.2&
xx@ada:~$ python2.7&
Python 2.7.9 (default, Jan& 3 :08)&&
[GCC 4.9.1] on linux2&
Type &help&, &copyright&, &credits& or &license& for more information.&
&&& exit()&
xx@ada:~$&&
当然, 我们也可以指定python的路径, 为查看python的版本, 如下:
xx@ada:~$ /usr/bin/python --version&
Python 2.7.8&
xx@ada:~$ /usr/bin/python2.7 --version&
Python 2.7.8&
xx@ada:~$ /usr/bin/python3.4 --version&
Python 3.4.2&
xx@ada:~$ /usr/local/bin/python --version&
Python 2.7.9&
xx@ada:~$ /usr/local/bin/python2.7 --version&
Python 2.7.9&
xx@ada:~$&&
至此, 我们就已经介绍完了python在ubuntu下的三种安装方法。
OK, Enjoy it!!!
继上, 由于我在安装python2.7.9之前安装过了虚拟运行环境virtualenv和virtualenvwrapper, 当安装完了python2.7.9后, 默认的python版本发生了变化, 所以当我再次打开终端时出现以下信息:
/usr/local/bin/python: No module named virtualenvwrapper&
virtualenvwrapper.sh: There was a problem running the initialization hooks.&&
If Python could not import the module virtualenvwrapper.hook_loader,&
check that virtualenvwrapper has been installed for&
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python and that PATH is&
set properly.&
xx@ada:~$&&
由上面的信息我们可以知道新安装的python2.7.9安装目录下找不到模块virtualenvwrapper, 但她们依然可用, 不妨我们在终端下试下以下几个命令
$ virtualenv --help
$ mkivrtulaenv --help
/usr/local/bin/python: No module named virtualenvwrapper&
virtualenvwrapper.sh: There was a problem running the initialization hooks.&&
If Python could not import the module virtualenvwrapper.hook_loader,&
check that virtualenvwrapper has been installed for&
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python and that PATH is&
set properly.&
xx@ada:~$ workon&
xx@ada:~$ workon env&
/usr/local/bin/python: No module named virtualenvwrapper&
/usr/local/bin/python: No module named virtualenvwrapper&
(env)xx@ada:~$ deactivate&
/usr/local/bin/python: No module named virtualenvwrapper&
/usr/local/bin/python: No module named virtualenvwrapper&
xx@ada:~$&&
可见,这不影响虚拟运行环境。但每次打开终端都看到那些信息, 有强迫证的我目前正在努力寻找解决方法...
我们键入pip freeze来看看已安装的python模块:
xx@ada:~$ pip freeze&
adium-theme-ubuntu==0.3.4&
apt-xapian-index==0.46&
ccsm==0.9.12&
characteristic==0.1.0&
chardet==2.2.1&
colorama==0.3.1&
command-not-found==0.3&
compizconfig-python==0.9.12&
debtagshw==0.1&
defer==1.0.6&
dirspec==13.10&
duplicity==0.6.23&
gevent==1.0.1&
greenlet==0.4.5&
html5lib==0.999&
httplib2==0.9&
idna==0.9&
lockfile==0.8&
lxml==3.3.6&
oauthlib==0.6.1&
oneconf==0.3.7&
PAM==0.4.2&
pbr==0.10.7&
pexpect==3.2&
Pillow==2.6.1&
piston-mini-client==0.7.5&
pyasn1==0.1.7&
pyasn1-modules==0.0.5&
pycrypto==2.6.1&
pycups==1.9.67&
pycurl==7.19.5&
pygobject==3.14.0&
pyOpenSSL==0.13.1&
pyserial==2.6&
python-apt===0.9.3.10ubuntu1&
python-debian==0.1.22&
pyxdg==0.25&
reportlab==3.1.8&
service-identity==1.0.0&
sessioninstaller==0.0.0&
six==1.7.3&
software-center-aptd-plugins==0.0.0&
stevedore==1.1.0&
system-service==0.1.6&
Twisted-Core==14.0.2&
Twisted-Web==14.0.2&
unity-lens-photos==1.0&
urllib3==1.8.3&
virtualenv==12.0.4&
virtualenv-clone==0.2.5&
virtualenvwrapper==4.3.1&
wheel==0.24.0&
xdiagnose==3.6.6&
zope.interface==4.1.1&
xx@ada:~$&&
好了,到了这这里,你的python2.7.9已经安装在64位的ubuntu14.10系统上了,是不是感觉比想象中简单。
上一页: &&&&&下一页:相关内容查看: 1272|回复: 5
优麒麟14.04手贱卸载了python2.7
该用户从未签到
我用的是XP和ubuntu的双系统。前天不小心卸载了自带的python2.7,然后桌面出错了。我就重装ubuntu14.04,可是 也不行啊,桌面还是进不去。好奇怪。都是格式化之后在装的,为啥还是会有问题?求教!
本帖子中包含更多资源
才可以下载或查看,没有帐号?
TA的每日心情奋斗昨天&10:41签到天数: 533 天[LV.9]以坛为家II
应该跟你之前操作没关系吧,你点击Show Details看下具体什么问题
该用户从未签到
应该跟你之前操作没关系吧,你点击Show Details看下具体什么问题
我用livecd 都不能正常显示桌面,左边和上边的工具栏都没有,,只有桌面几个图标,终端用快捷键打不开。感觉太奇怪了 难道是我硬件的问题?
TA的每日心情开心 14:39签到天数: 3 天[LV.2]偶尔看看I
15.04都出来了,你还在跟14.04较劲!终端问题,我的解决方法是随便进入哪个文件夹,然后鼠标右键,选择用终端打开。左边和上边的工具栏没有的问题,我的解决方法是用adduser或useradd命令再建立一个用户,然后进入那个用户试试。我的经验是那两个命令,有一个有用,另一个没用。
TA的每日心情开心前天&09:01签到天数: 206 天[LV.7]常住居民III
你是不是单独划分了home分区?我有一次也是这样,后来将home分区也格式化了再重装,问题就解决了。我也想不通,按道理home不会存储用户设置啊?
TA的每日心情开心 05:49签到天数: 1 天[LV.1]初来乍到
楼主原来安装,缓冲分区在哪里?
重装系统,会自动找这个分区,如果没有格式化,数据还在且是错误的,ta就会照样使用。
Powered by请教,ubuntu10.04下,如何卸载python2.7.8_百度知道
请教,ubuntu10.04下,如何卸载python2.7.8
提问者采纳
直接输入这个命令就好了sudo apt-get remove python2.7
来自团队:
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁python 2.7 - I run `sudo apt-get remove python2.7`, can I restore my Ubuntu now? - Ask Ubuntu
to customize your list.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. J it only takes a minute:
Here's how it works:
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
I wanted to remove and reinstall python2.7 interpreter on 12.04
But when I did sudo apt-get remove python2.7, The crazy terminal started to remove everything!!! Any idea how I can restore whatever I've removed?
24.2k90384587
While reinstalling Ubuntu is probably the easiest way, it's worth pointing out that it's possible to recover without reinstalling everything.
To do this, manually download the python2.7 package (and its dependencies), and manually install them using dpkg (bypassing APT, which requires Python). Once that's installed, apt should work again, and so apt-get install ubuntu-desktop will restore your system. (If apt-get still doesn't work, you might also need to download and install any missing dependencies.)
In the future, if you need to reinstall a package, instead use
sudo apt-get install --reinstall python2.7
sudo aptitude reinstall python2.7
which reinstalls the package without having to remove the dependencies.
3,03431435
Removing Python is not a good idea as much of Ubuntu depends on it. You may have seen a warning telling you which packages depend on python and thus will be removed with Python. When proceeding you end up with a quite stripped down OS.
Reinstalling Ubuntu would now be the easiest and safest way to get it back. Take care not to delete your HOME when you do so.
75.6k27191286
If it's not too late for anyone, or if you have come across this problem lately, this is how I got it running:
I followed Mechanical snail's advice and downloaded all the packages using Synaptic. I selected all the relevant packages, basically everything with "python", "python2", "python3", "apt", "python-apt", etc., that was already installed in my computer, tagged them for reinstallation, and when I hit apply, I made sure I downloaded them only.
Then, under root, I went into the /var/cache/apt/archives folder and ran the following command to manually re-install everything I downloaded (you will see all the packages you downloaded with Synaptic in here):
dpkg --unpack *.deb
Anyway, I was getting this apt_pkg error whenever I would get an error message from a Python script in Aptana, and yesterday when I was trying to add a repo. Now at least I can add the repo with no problem, but I'm still getting the apt_pkg error whenever there is an error in my Python scripts...
Running the script outside of Aptana by calling python3.2 or python3 which points at 3.2 works (meaning I get the script's error without the apt_pkg error), but if I run it with python3.3 then the error is back.
21.9k1685135
I also had the same problem.
And I was able to fix it going to ctrl+alt+f1, logged in with my username and password
sudo apt-get update
sudo apt-get install --reinstall ubuntu-desktop
And it reinstalled most (if not all) the deleted files (along with unity and terminal)
You need to execute this: apt-get install ubuntu-desktop
and then apt-get install gdm. When asked lightdm or gdm select gdm.
both as root or using sudo
sudo apt-get purge python && sudo apt-get install python2.7
sudo apt-get install python-pip
removes and reinstalls python and pip, then you can install apps like flask, bottle and many others
eg sudo pip install flask try to install your apps with python
During un-installation of Python, I abruptly closed the terminal. Hence Python was partially removed.
I fixed it with the following commands
sudo apt-get update
sudo apt-get install --reinstall ubuntu-desktop
sudo apt-get install –-reinstall python-apt
sudo apt-get install –-reinstall python2.7
In a fit of senseless haste I removed python 2.7 and it removed a lot of packages that were dependent on it. I could not even launch terminal.
I dropped to tty1 and did what Lois Mari Ang Laput suggested
sudo apt-get update
sudo apt-get install --reinstall ubuntu-desktop
I got back the desktop and could launch terminal. Packages like shutter, mysql-workbench, that were removed needed to be reinstalled.
I checked the history in /var/log/apt and reinstalled all packages that were removed.
you can recover using live CD using chroot
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Ubuntu and Canonical are registered trademarks of Canonical Ltd.
Ask Ubuntu works best with JavaScript enabled

我要回帖

更多关于 ubuntu python 2.7.6 的文章

 

随机推荐