Linux system with Python and anaconda switch

Source: Internet
Author: User

The little woman is not, can not solve in the anaconda environment to compile Caffe, also can not solve in Anaconda environment install TensorFlow, so can only be used with a python, a will use Anaconda

Then, if you modify the file in ~/.BASHRC, that is, add the export path= "/home/myname/anaconda2/bin: $PATH", the input Python command will be directly out of the anaconda environment of Python, of course , with TensorFlow is good, with Caffe on ..... Therefore, with Caffe words, I will remove this line, and then the source ~/.BASHRC again.

This is a bit of a hassle, but what about it? I wanted to use my own Python under Caffe and use Anaconda in TensorFlow.

So, I learned a "trick" called alias Declarationalias.

Specific usage:

Alias py27= "/usr/bin/python2.7" 
alias pyana= "/home/myname/anaconda2/bin/python2.7" (my own, must be accurate to the Python version, Cannot only go to folder)

So when you use the system with Python, just enter py27 at the command line, and use Anaconda to enter either Python or Pyana.

Note:
1. In ~/.BASHRC's document, Export path= "/home/myname/anaconda2/bin: $PATH" is to be added
2. The above two lines in each boot time is to enter, if you do not want to enter each time, you want to add these two lines to the ~/.BASHRC file
3. If you want to cancel the alias declaration, use Unalias py27 or delete the path in the ~/.BASHRC, and then source it again ~/.BASHRC

Appendix: Simple Use of Cona

Conda create-n [name]     #创建名为name的conda环境, such as TensorFlow
source activate [name]     #激活刚才创建的环境, after the command is complete, answer the first name of the environment that you just created before the command line
source deactivate [name]    #退出名为name的环境, back to system default environment
Conda remove-n [name]--all   
Conda Info-envs    #查看所安装环境列表, the environment created is under the ' ~/anaconda2/envs/' directory
Conda List      #查看已经安装的包
Conda install [PackageName]        #安装具体的包, plus-n [name] can be installed to the specified environment
Conda list-n [name]      #name环境下安装了哪些包
Conda update-n [name] [PackageName]     #升级name环境的名为packagename的包
conda remove-n [name] [PackageName] #删除name环境的名为packagename的包 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.