centosの下で、yumを使ってPython 3環境を配置します.

2713 ワード

Pythoon 3をインストールします.ユームを使ってPythoonをインストールします.
#        EPEL
yum install epel-release  
#   Python3.6  
yum install python36
#   pip3
yum install python36-pip
#   pip3
python3 -m pip install --upgrade pip
FAQ
pip 3国内ソースを使用する
  :https://pypi.tuna.tsinghua.edu.cn/simple
   :http://mirrors.aliyun.com/pypi/simple/
       https://pypi.mirrors.ustc.edu.cn/simple/
      :http://pypi.hustunique.com/
      :http://pypi.sdutlinux.org/
  :http://pypi.douban.com/simple/
note:新版のuuntuはhttpsソースの使用を要求します.注意してください.
pipを使用するときはパラメータ-iを追加することができます.https://pypi.tuna.tsinghua.edu.cn/simple たとえば:
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider
このように清华侧のミラーからpyspiderライブラリをインストールします.
pip生成とインストールrequirements.txt
#       
pip3 freeze > requirements.txt
#       
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r equirements.txt
依存パケットがない場合の解決方法
以下のエラーメッセージは、依存パケットが不足しています.解決時には対応する依存パッケージをインストールする必要があります.
ImportError: libXrender.so.1: cannot open shared object file: No such file or directory
  • 解決方法:
  • 依存パケットを確認する
  •     [root@localhost easy12306]# yum provides libXrender.so.1
             :fastestmirror, langpacks
        Loading mirror speeds from cached hostfile
        * base: centos.ustc.edu.cn
        * epel: mirrors.yun-idc.com
        * extras: centos.ustc.edu.cn
        * updates: centos.ustc.edu.cn
        libXrender-0.9.10-1.el7.i686 : X.Org X11 libXrender runtime library
             :base
            :
              :libXrender.so.1
        libXrender-0.9.10-1.el7.i686 : X.Org X11 libXrender runtime library
             :@base
            :
              :libXrender.so.1
    
    -         
    
        [root@localhost easy12306]# yum search libXrender
             :fastestmirror, langpacks
        Loading mirror speeds from cached hostfile
        * base: centos.ustc.edu.cn
        * epel: fedora.cs.nctu.edu.tw
        * extras: centos.ustc.edu.cn
        * updates: centos.ustc.edu.cn
        ============================================================================================================ N/S matched: libXrender ============================================================================================================
        libXrender.i686 : X.Org X11 libXrender runtime library
        libXrender.x86_64 : X.Org X11 libXrender runtime library
        libXrender-devel.i686 : X.Org X11 libXrender development package
        libXrender-devel.x86_64 : X.Org X11 libXrender development package
                  only,  “search all”  。
    
    -         
    
        [root@localhost easy12306]# yum install libXrender.x86_64