I will participate in an in-house study session on the theme of "Let's make a Web system in a language that I have never touched". Since I am in charge of investigating python, I will summarize the contents of the investigation. First of all, from the environment construction.
There is also a way to drop the source and install it in Official, With pythonbrew, you can install multiple versions of python, and it doesn't pollute the environment too much. (It feels like Ruby's RVM), so build the environment with pythonbrew.
First, install pythonbrew. This time install as multi-user.
$ git clone https://github.com/utahta/pythonbrew
$ cd pythonbrew
$ sudo ./pythonbrew-install
Install python 3.3.0. If you want to use sudo, you can use the sudo pybrew command, but I got an error. I wonder if it's a PATH problem. .. ..
$ sudopybrew install --force 3.3.0
-bash: sudo PYTHONBREW_ROOT=/usr/local/pythonbrew PATH=/usr/local/pythonbrew/bin:/usr/local/rvm/gems/ruby-1.9.3-p448/bin:/usr/local/rvm/gems/ruby-1.9.3-p448@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p448/bin:/usr/local/rvm/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/vagrant/bin /usr/local/pythonbrew/bin/pythonbrew:There is no such file or directory
There is no help for it, so install as root. It seems to have worked.
$ sudo su -
# pythonbrew install --force 3.3.0
# pythonbrew switch 3.3.0
# python --version
Python 3.3.0
# which python
/usr/local/pythonbrew/pythons/Python-3.3.0/bin/python
HelloWorld!! Let's try the customary Hello World. Save the following code as helloworld.py.
helloworld.py
print("Hello World")
Execute. Hello World was done properly! !!
# python helloworld.py
HelloWorld!!
By the way, if you execute it only with the python command, it will be in interactive mode, and you can also do Hello World as follows.
# python
Python 3.3.0 (default, Jul 8 2013, 09:11:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("HelloWorld!!")
HelloWorld!!
Recommended Posts