zoukankan      html  css  js  c++  java
  • Linux别名工具alias的使用

    偶然发现Linux支持自定义命令

    现在Linux环境上经常有多个python环境,但是python2马上要停止维护了,所以我想多使用python3,但是Linux上的python命令调用的是python3

    有两种方案

    1、在/usr/bin目录下生成新的软连接进行调用

    2、还有种方式就是通过alias别名工具将python命令更改默认调用python3

    具体实现如下:

    user@computer:~$ ls /usr/bin/python*
    /usr/bin/python              /usr/bin/python2-wsdump    /usr/bin/python3-jsonpatch    /usr/bin/python3.6m
    /usr/bin/python2             /usr/bin/python2.7         /usr/bin/python3-jsonpointer  /usr/bin/python3m                 /usr/bin/python2-jsonschema  /usr/bin/python3           /usr/bin/python3-jsonschema                                     /usr/bin/python2-pbr         /usr/bin/python3-jsondiff  /usr/bin/python3.6

    得到目录下的python3环境路径,通过alias命令将python命令调用的python2改为python3

    user@computer:~$ alias python="/usr/bin/python3"                                                                     
    user@computer:~$ python Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> exit()

    这样就比较简单的可以直接使用python命令来调用python3了

  • 相关阅读:
    创建可视化优秀网站的40个精美jquery插件推荐
    究极程序员跨过的艰难六步
    编写可移植的PHP代码
    程序员如何保持优秀
    网站安全检查列表
    PHP之谈(四)——smarty模板的学习
    PHP
    弱校ACM奋斗史
    学习PHP重在坚持
    About Me
  • 原文地址:https://www.cnblogs.com/bestwei/p/11714740.html
Copyright © 2011-2022 走看看