美文网首页
Linux下虚拟环境的使用node、python

Linux下虚拟环境的使用node、python

作者: 飞跑的蛤蟆 | 来源:发表于2021-02-02 11:51 被阅读0次

    node.js

    node.js的版本管理工具为nvm,镜像地址管理工具为nrm
    nvm常用命令:

    • nvm ls-remote 查看远程仓库中可用的版本
    • nvm install 12.20.1 --default 安装指定版本(并设为默认)
    • nvm install --lts 安装最新的LTS
    • nvm use 12.20.1
    • nvm run default --version 查看默认node的版本
    # jesse @ jesse-loptop in ~ [11:33:26] 
    $ nvm use 12.20.1
    Now using node v12.20.1 (npm v6.14.10)
    
    # jesse @ jesse-loptop in ~ [11:34:01] 
    $ nvm run default --version
    Running node v12.20.1 (npm v6.14.10)
    v12.20.1
    
    # jesse @ jesse-loptop in ~ [11:34:21] 
    $ node --version
    v12.20.1
    

    添加淘宝npm镜像源:

    npm config set registry http://registry.npm.taobao.org/
    

    安装nrm

    npm install -g nrm
    

    安装yarn

    npm install -g yarn
    

    nrm常用命令

    • nrm ls 查看可用的镜像地址
    • nrm use taobao 使用taobao镜像

    python

    python的版本管理工具为pyenv,包管理工具为pipenv

    首先,安装python源码的编译环境,然后再进行python的安装

    sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev llvm libncurses5-dev libncursesw5-dev tk-dev libffi-dev liblzma-dev libxslt1-dev libsqlite3-dev cmake libgdbm-dev -y
    

    pyenv常用命令

    • pyenv install --list 查看远程仓库可用的版本
    • pyenv install 3.6.12 安装指定版本
    • pyenv global 3.6.12 设置指定版本为默认

    配置pip源

    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
    

    pipenv常用命令

    • pipenv install

    nvm

    Example:
      nvm install 8.0.0                     Install a specific version number
      nvm use 8.0                           Use the latest available 8.0.x release
      nvm run 6.10.3 app.js                 Run app.js using node 6.10.3
      nvm exec 4.8.3 node app.js            Run `node app.js` with the PATH pointing to node 4.8.3
      nvm alias default 8.1.0               Set default node version on a shell
      nvm alias default node                Always default to the latest available node version on a shell
    
      nvm install node                      Install the latest available version
      nvm use node                          Use the latest version
      nvm install --lts                     Install the latest LTS version
      nvm use --lts                         Use the latest LTS version
    
      nvm set-colors cgYmW                  Set text colors to cyan, green, bold yellow, magenta, and white
    
    Note:
      to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)
    

    pipenv

    Usage Examples:
       Create a new project using Python 3.7, specifically:
       $ pipenv --python 3.7
    
       Remove project virtualenv (inferred from current directory):
       $ pipenv --rm
    
       Install all dependencies for a project (including dev):
       $ pipenv install --dev
    
       Create a lockfile containing pre-releases:
       $ pipenv lock --pre
    
       Show a graph of your installed dependencies:
       $ pipenv graph
    
       Check your installed dependencies for security vulnerabilities:
       $ pipenv check
    
       Install a local setup.py into your virtual environment/Pipfile:
       $ pipenv install -e .
    
       Use a lower-level pip command:
       $ pipenv run pip freeze
    

    相关文章

      网友评论

          本文标题:Linux下虚拟环境的使用node、python

          本文链接:https://www.haomeiwen.com/subject/xpzetltx.html