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

分享到:

39 条评论

昵称
  1. Hey there would you mind stating which blog platform you’re using?
    I’m planning to start my own blog soon but I’m having a
    difficult time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design and style seems different then most blogs and I’m looking for something unique.

    P.S Sorry for getting off-topic but I had to ask!

  2. Hey would you mind sharing which blog platform you’re using?

    I’m looking to start my own blog soon but I’m having a difficult time choosing between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design seems different then most blogs and I’m looking for something completely unique.
    P.S Sorry for being off-topic but I had to ask!

  3. I was curious if you ever considered changing the page
    layout of your blog? Its very well written; I love what youve got to say.

    But maybe you could a little more in the way of content so people could
    connect with it better. Youve got an awful lot of text for only having 1 or two images.

    Maybe you could space it out better?

  4. Stunning quest there. What happened after?
    Good luck!

  5. Hello, I think your blog might be having browser compatibility issues.
    When I look at your blog in Ie, it looks fine but when opening
    in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, terrific
    blog!

  6. Howdy! I’m at work browsing your blog from my new apple iphone!
    Just wanted to say I love reading your blog and look
    forward to all your posts! Carry on the superb work!

  7. Pretty great post. I just stumbled upon your blog and
    wanted to mention that I’ve really loved surfing around
    your blog posts. In any case I will be subscribing in your rss feed and
    I hope you write again very soon!

  8. I was wondering if you ever considered changing the layout
    of your website? Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could
    connect with it better. Youve got an awful lot of text for only having one or 2 images.
    Maybe you could space it out better?

  9. Great work! That is the type of information that are supposed
    to be shared around the web. Shame on the search engines for no longer
    positioning this submit higher! Come on over and visit my site .
    Thanks =)