Python3 Beginning Part 1

Refusal

First off (excuse w), this article is my reminder that I have never touched Python. I think that there are many "mistakes" and "misunderstandings" in the description, so please kindly point out.

Background

When creating a simple app, I used to create it with Ruby on Rails. I'm a Framework enthusiast, even though I haven't mastered Ruby, so I'll try to flirt with the Web Framework of Python for some reason. I've been interested in Python since about last year, but at that time it seems that Frameworks such as Django didn't support Python3, so I gave up learning emotionally. However, the recent Framework is now compatible with Python3, so I decided to restart it. If you want to start anew, the combination of Python3 and Framework between the new versions is more efficient, and I think it will be less troublesome due to the consistency of various versions.

Development environment

PC: MacOS X 10.9.4 Python3.4.1

Check Python version

Check the version of Python installed. Start the terminal and type python --version as shown below. Apparently, Python 2.7.5 is installed by default in my PC environment. スクリーンショット 2014-08-31 12.34.19.png

Python download

So, go to the Python download site and download it. As of the end of August 2014, the latest seems to be Python 3.4.1. Then press the download button to download and you can download python-3.4.1-macosx10.6.dmg.

スクリーンショット 2014-08-31 12.31.09.png

Click the downloaded dmg file to decompress it. Click on Python.mpkg in the unzipped file.

スクリーンショット 2014-08-31 13.14.17.png

However, in my environment I got an installation warning.

If the installer does not start

スクリーンショット 2014-08-31 13.18.52.png

From here, it's a bit of a detour, but open "Security & Privacy" from "System Preferences".

スクリーンショット 2014-08-31 13.23.24.png

As shown below, there is a message "" Python.mpkg "could not be opened because the developer cannot be confirmed.", So click the "Open as is" button.

スクリーンショット 2014-08-31 13.25.58.png

By the way, if the "Allow applications from Mac App Store and confirmed developers" selection is grayed out, you can change it by clicking the key at the bottom left, asking for your password.

スクリーンショット 2014-08-31 13.31.07.png

Launch the Python installer

Once the installer launches successfully, continue with your consent.

スクリーンショット 2014-08-31 13.33.48.png

スクリーンショット 2014-08-31 13.34.23.png

スクリーンショット 2014-08-31 13.34.52.png

スクリーンショット 2014-08-31 13.35.14.png

Reconfirm Python version

Check the version of Python from the terminal again. However, for some reason, the version of Python that can start commands does not change. Actually, I was a little addicted to it, but it seems that the Python3 command is started with python3.

スクリーンショット 2014-08-31 13.42.02.png

By the way, the substance of the python3 command when installed by the above method seems to be the following path.

/Library/Frameworks/Python.framework/Versions/3.4/bin/Python3.4

スクリーンショット 2014-08-31 20.55.38.png

In general, it's unclear whether it's better to break the alias for the python command or change the path.

About Python packages

I don't know very well, but tools such as pip, ʻeasy-install, and pyvenv(such asgem in Ruby?) Are also located in the same directory and can be passed through the path. Seems to be. However, when executing the command, it seems necessary to add version (3) like pip3`. This area may get confused later.

スクリーンショット 2014-08-31 21.06.08.png

For the time being, the article has become long, so this time I will stop here.

Recommended Posts

Python3 Beginning Part 1
QGIS + Python Part 2
QGIS + Python Part 1
Python: Scraping Part 1
Python: Scraping Part 2
Python basic memorandum part 2
Python basic memo --Part 2
Python basic memo --Part 1
Studying Python with freeCodeCamp part1
Bordering images with python Part 1
Python application: Pandas Part 1: Basic
Scraping with Selenium + Python Part 1
Python: Ship Survival Prediction Part 2
Python
Python: Supervised Learning: Hyperparameters Part 1
Python Basic Grammar Memo (Part 1)
Python: Ship Survival Prediction Part 1
Studying Python with freeCodeCamp part2
Solving Sudoku with Python (Part 2)
Python: Ship Survival Prediction Part 3
Python: Stock Price Forecast Part 2
Python: Supervised Learning: Hyperparameters Part 2
Scraping with Selenium + Python Part 2
Basics of Python × GIS (Part 1)
Python: Stock Price Forecast Part 1
Transpose CSV files in Python Part 1
Basics of Python x GIS (Part 3)
Playing handwritten numbers with python Part 1
perl objects and python class part 2.
Python Application: Data Cleansing Part 1: Python Notation
First Python 3 ~ The beginning of repetition ~
[Automation with python! ] Part 1: Setting file
Python Application: Data Handling Part 3: Data Format
Studying Python Part.1 Creating an environment
[Blender x Python] Particle Animation (Part 1)
Python application: Numpy Part 3: Double array
Basics of Python x GIS (Part 2)
Automate simple tasks with Python Part0
Python application: data visualization part 1: basic
Excel aggregation with Python pandas Part 1
kafka python
datetime part 1
Basic Linear Algebra Learned in Python (Part 1)
Python Summary
Built-in python
Python comprehension
Python technique
Homebrew Python Part 3-Amazon Product Search Program
Studying python
Python 2.7 Countdown
Python FlowFishMaster
GUI creation in python using tkinter part 1
Python service
python tips
AM modulation and demodulation in Python Part 2
Python Application: Data Visualization Part 3: Various Graphs
python function ①
Python basics
Python memo
Play handwritten numbers with python Part 2 (identify)
ufo-> python (3)