Centos7安装python3注意事项

make install必备的包:yum install libffi-devel -y 如没有安装会报:

ModuleNotFoundError: No module named ‘_ctypes’

安装完之后执行python依旧是2.x的版本,需要使用python3的格式来运行。可以建立一个软连接把python3映射到python命令来

mv /usr/bin/python /usr/bin/python.bak  #把之前的备份

ln -s /usr/python/bin/python3 /usr/bin/python

由于yum默认是2.x的python,所以我们要把python头换成python2

vim  /usr/bin/yum

把 #! /usr/bin/python修改为  #! /usr/bin/python2

同理 vim  /usr/libexec/urlgrabber-ext-down

Tip:pip官方源通常会出现无法下载的问题。通过修改国内源可以解决这个问题:

pip install xlrd -i http://pypi.douban.com/simple –trusted-host pypi.douban.com

下面是常用的国内源地址:

1)http://mirrors.aliyun.com/pypi/simple/ 阿里云

2)https://pypi.mirrors.ustc.edu.cn/simple/  中国科技大学

3) http://pypi.douban.com/simple/  豆瓣

4) https://pypi.tuna.tsinghua.edu.cn/simple/ 清华大学

5)  http://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学

enjoy it

分享到:

69 条评论

昵称
  1. I will immediately grab your rss feed as I can’t find your e-mail subscription link or newsletter service.
    Do you have any? Please allow me understand so that
    I may subscribe. Thanks.

  2. Hey! Would you mind if I share your blog with my facebook group?
    There’s a lot of folks that I think would really appreciate your content.
    Please let me know. Thank you

  3. ETIAS Visa

    I simply couldn’t leave your website prior to suggesting that I really loved the standard information an individual provide on your guests?
    Is gonna be back incessantly to check up on new posts

  4. I have been surfing online more than 3 hours nowadays,
    but I never found any fascinating article like yours.

    It’s pretty price sufficient for me. In my opinion, if
    all web owners and bloggers made good content as you did, the internet will probably be a lot more useful than ever before.

  5. Today, I went to the beach with my kids. I found a sea shell and gave it to my 4 year old daughter
    and said “You can hear the ocean if you put this to your ear.” She put the shell
    to her ear and screamed. There was a hermit crab inside and it pinched
    her ear. She never wants to go back! LoL I know this is totally
    off topic but I had to tell someone!

  6. Heya! I’m at work browsing your blog from my new iphone
    3gs! Just wanted to say I love reading your blog and look forward to all your posts!
    Keep up the outstanding work!

  7. minecraft games

    Your means of explaining the whole thing in this post is actually nice, all
    be capable of simply be aware of it, Thanks a lot.

  8. minecraft games

    Thank you, I have just been searching for info about this topic for ages and yours is the best I have discovered so far.
    However, what concerning the conclusion? Are you certain in regards to the supply?

  9. minecraft games

    Howdy I am so happy I found your website, I really found you
    by accident, while I was searching on Yahoo for something else, Nonetheless I am here now and would
    just like to say many thanks for a remarkable post and a all round interesting blog (I also love the theme/design), I don’t have time to read through it
    all at the minute but I have saved it and also added in your RSS
    feeds, so when I have time I will be back to read a great deal more, Please do keep up
    the awesome work.