linuxpython升级3.5_将linux 2.7上的python更新到3.5

So I updated python using these instructions:

sudo apt-get install build-essential checkinstall

sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-devlibsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

then

cd ~/Downloads

wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz

tar -xvf Python-3.5.0.tgz

cd Python-3.5.0

then

./configure

sudo make install

python3.5

Python 3.5.0 (default, Oct 3 2015, 03:16:42)

[GCC 4.8.4] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>>

and it worked but when I closed terminal, and wrote

python -v

it is still python 2.7 and still getting errors executing code that use v3+ standard libraries

How to make it working as 3.5?

解决方案

You still have Python 2 installed, and the python command is still set up to invoke that version by default.

Try running your scripts like this:

python3 yourscriptname.py

In /usr/bin/, "python" is actually a symlink to python2.7. If you'd rather not have to type the 3 at the end whenever you use python, change that symlink to point to python3 instead. Then python will run Python 3.5 and you can use python2.7 or just python2 to run Python 2.7 scripts.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值