Recently, Python was unusually fond of, after reading the Vamei great God's Python quick tutorial (see the standard library do not want to see), did some leetcode topic familiar with the basic syntax, and then ready to use Scarpy crawl Web pages, and then use collaborate The filler algorithm makes a film recommendation system. Yesterday I learned a day scarpy, today was ready to continue to learn, found a UCB course cs61a, with Python teaching, a full range of teaching video, handouts, homework, lab, final exams have everything. This is opium and opium for my foreign public class control. But the teaching use is Python3, my system environment is python2, and mainly will use this environment. What do we do? Some people say virtual machine, virtual machine Your sister Ah, Occupy memory not to say, and dead card, inconvenient! Baidu, found that there is a method called virtualenv, tutorial in this, there is a need to pick up, below I focus on the second method I use Pythonbrew.
Pythonbrew
Pythonbrew is actually a python sandbox, which can be installed in a variety of Python versions, can temporarily change the environment as needed (in the current terminal)
or change it permanently, or you can turn it off, just use the system environment.
Installation
Execute the following command
CURL-KL http://xrl.us/pythonbrewinstall | bash
Add the following to the~/.bash_profile(没有的话touch一个然后vim改就好咯)
[-S $HOME/.PYTHONBREW/ETC/BASHRC]] && source $HOME/.pythonbrew/etc/basic
Other People's blog useful easy_install or Pip, I tried, after the installation has no corresponding Pythonbrew command (as if only Pythonbrew_install and another has a similar format two commands, executed the former will also show the successful installation of information , but I don't know how to use it)
After success, you will be prompted with the following information
1 well-done! Congratulations!2 3 The pythonbrew is installed as:4 5 /users/dqf/.pythonbrew6 7 Add the following line to the end of your ~/.BASHRC8 9 [[-S "$HOME/.PYTHONBREW/ETC/BASHRC"]] && source "$HOME/.PYTHONBREW/ETC/BASHRC"Ten OneAfter that, exit the this shell, start a new one,and install some fresh A Pythons: - -Pythonbrew Install 2.7.2 thePythonbrew Install 3.2 - -For further instructions,Run: - + Pythonbrew Help - + The default Help messages would popup and tell you about do! A atEnjoy Pythonbrew at/users/dqf/.pythonbrew!!
View desc
This tip is actually a bit of a problem.
Use
List the versions of Python that can be installed:pythonbrew list --know
To install a version of Python:pythonbrew install 2.7.3
To delete a version of Python that is already installed:pythonbrew uninstall 2.7.3
Lists the installed Python versions (which are marked with an asterisk after the currently used version):pythonbrew list
Use a version of Python (only the current terminal window is valid):pythonbrew use 2.7.3
Switch to a version of Python (always valid):pythonbrew switch 2.7.3
Clean up stale source directories and archive packages:pythonbrew cleanup
Upgrade to Pythonbrew to the latest version:pythonbrew update
Disable Pythonbrew (that is, switch back to the original environment):pythonbrew off
Create a Python isolated environment (with virtualenv):
Pythonbrew venv initpythonbrew venv Create projpythonbrew venv listpythonbrew venv use projpythonbrew venv Delete Projpyth Onbrew venv Rename proj Proj2
View Code
- View Pythonbrew version:
pythonbrew version
For more information, please see the pythonbrew Chinese document: Read the docs
/etc/profile,/etc/bashrc,~/.bash_profile,~/.profile,~/.bashrc
I didn't understand it before, and now we've got some information, done some experiments, and finally got a little bit more.
My system is OS X 10.9.4, the result of the test is: For all users, login account (SSH remote login or open terminal in the local) system-level "/etc/profile" and "/ETC/BASHRC" is the inevitable implementation, and is the first execution of two, Then execute "~/.bash_profile" If you enter bash in the terminal, then go to bash to execute ~/.BASHRC.
Of course, there are many shells under the Mac, such as ZSH, its configuration file is ~/.ZSHRC (not found?? Touch a chant)
First say so much, feel the shell is quite interesting, since the change of Mac, the enthusiasm for learning new technology has also soared a lot of
Pythonbrew Installation and Configuration/macosx