• python 安装


    1.安装python
    参考:https://www.cnblogs.com/hgz-dm/p/11356423.html
    官网下载源码:https://www.python.org/downloads/release/python-379/

    上传到服务器:/usr/local/Python-3.7.9.tgz

    检查是否下载完整文件,与官网的MD5 Sum对比:
    [root@cnsz92vl09569 local]# md5sum Python-3.7.9.tgz

    解压文件:
    [root@cnsz92vl09569 local]# tar -zxvf Python-3.7.9.tgz

    [root@cnsz92vl09569 local]# cd Python-3.7.9

    安装:
    ./configure --prefix=/usr/local/python3.7

    make && make install

    2.配置软链接(这样不必每次启动python时都需要进入其安装路径下启动):

    rm -rf /usr/bin/python3.7

    rm -rf /usr/bin/pip3

    ln -s /usr/local/python3.7/bin/python3.7 /usr/bin/python3.7
    ln -s /usr/local/python3.7/bin/pip3.7 /usr/bin/pip3

    3.验证是否安装成功:
    验证

    4.配置python源地址:
    pip 的配置文件一般位于(如果没有就新建一个):

    Unix/Linux 环境: $HOME/.config/pip/pip.conf
    macOS: $HOME/Library/Application Support/pip/pip.conf
    Windows: %APPDATA%pippip.ini

    5.配置virtualenv:
    [root@cnsz92vl09569 pip]# pip3 install virtualenv

    5.1.创建目录:
    [root@cnsz92vl09569 py_virtualenv]# pwd
    /usr/local/py_virtualenv
    [root@cnsz92vl09569 py_virtualenv]# cd liuw_project/
    [root@cnsz92vl09569 liuw_project]#

    5.2.创建一个独立的Python运行环境,命名为liuw_venv:

    /usr/local/python3.7/bin/virtualenv --no-site-packages liuw_venv

    执行上面那一句会报错virtualenv: error: unrecognized arguments: --no-site-packages

    /usr/local/python3.7/bin/virtualenv liuw_venv

    rm -rf /usr/bin/virtualenv

    ln -s /usr/local/python3.7/bin/virtualenv /usr/bin/virtualenv
    virtualenv liuw_venv

    5.3.激活虚拟化环境:
    source liuw_venv/bin/activate

    5.4.安装包:
    pip3 list
    pip3 install SomePackage
    deactivate
    deactivate

    5.5.退出当前的liuw_venv环境,使用deactivate命令:
    (liuw_venv) [root@cnsz92vl09569 site-packages]# deactivate
    [root@cnsz92vl09569 site-packages]#
    deactivate

    安装中遇到的问题:
    报错:config:error :no acceptable C compiler found in $PATH(环境里没有安装gcc。)
    解决方案:yum install gcc

    报错:zipimport.ZipImportError: can't decompress data; zlib not available
    解决办法:
    yum -y install zlib*

    报错:ModuleNotFoundError: No module named '_ssl'
    https://www.cnblogs.com/hanfe1/p/13071020.html

    pip3 install anaconda
    报错:
    ModuleNotFoundError: No module named '_ctypes'
    ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    yum install libffi-devel -y

  • 相关阅读:
    [转] 蓝牙RSSI计算距离
    [转] 人工智能之机器学习路线图
    css3兼容在线处理
    a标签实现下载
    loading图标制作
    mongodb可视化工具
    title上面的图标怎么更改
    阿里云上传下载文件
    mongodb备份恢复
    RESTful
  • 原文地址:https://www.cnblogs.com/Arabi/p/14234468.html
Copyright © 2020-2023  润新知