SINGAPORE – MY FIRST FOREIGN TRIP

Last week, I and my friend made a trip to Singapore – one of the most beautiful country in the world.

Honestly, we made a team including four people and expected to travel to the North of Vietnam at first. However, twos in our team got busy. On the other hand, there was a storm which was striking our country in the North (Winter was coming!!!!!), so I and my friend decided to go to a country outside of Vietnam. Before the trip, we agreed that the country that we travel should be in South-East Asia because this is a short trip which was made in hurry, we didn’t have enough time to apply for visa. After a thorough review, we chose Singapore as the first foreign country that we visited.

We planed for four-day trip in Singapore and booked airline tickets, hostel, and some amusement parks online in advance. Because, as you know, Singapore is the country that welcome thousand tourists everyday, so, if you don’t wanna struggle to find a room or stay in line with hundreds of people to buy a ticket you should buy tickets online. Besides, if you have a plan trip and some tickets booked in advance, it will be easier for you to get entry to Singapore from the immigration airport.

Day 1: HELLO SINGAPORE

We began early at 6.00am to go to Tan Son Nhat international airport and check-in boarding pass. After that we waited for a while, got into the plane and it took off at 9.50am. Usually, it takes about 1 hour and 40 minutes to fly from Vietnam to Singapore and our plane landed in Changi international airport at nearly 12.00pm. What a beautiful airport! I can’t even imagine any other airports can be as splendid as it. Lots of massage chairs are put around to serve passengers, there are many flowers are planted on the wall, many art sculptures are placed along the way, etc. Actually, I thought it’s like a park rather than an airport.

20170720_132647

Changi airport

We chose MRT as a main transport to travel around Singapore, the cost is not expensive and we can buy EZ or NETs FlatPay card at any stores in the airport to use it. Normally, we paid about 8 SGD a day for this.

IMG-0523.JPG

NETs FlatPay card

From Terminal 3 of the airport, we got into the city using MRT to check-in the hostel. The hostel we booked online located on Chinatown, it costed 20 SGD per day. It’s very cheap as it’s kind of Dorm services in Singapore. For most travelers, Dorm is the best option to adopt because it can save their budget for other purposes and why we should hire a luxury hotel just to sleep?

After check-in at the hostel, we went to Raffle Place to go to Marina Bay by walking. It’s so so beautiful, and I got an indescribable feeling when I was there. Actually, it’s very hot in Singapore on July, but when we was going to the bay, the atmosphere there was different, till now, when I’m writing these lines, I have still felt the wind on my skin. The charm of the bay is one of reason make us came back to it every night.

Photo 16 29 35, 17-07-2017

Merlion at Marina Bay

Photo 16 36 47, 17-07-2017 (1)

Merlion at Marina Bay 2

About 6.00pm, we took the MRT to Ang Mo Kio and took the bus 138 there to visit Night Safari.

Our first day ended at 10.30pm when we came back to the hostel.

Day 2: THE DAY OF SENTOSA

On the second day in Singapore, as planed before, we spent all days to visit Sentosa Island. Actually, we used most time to play around Universal Studios Singapore.

Photo 07 43 18, 18-07-2017 (1)

Universal Studios Singapore

There was a painful experience that DON’T HESITATE TO PAY MORE MONEY FOR EXPRESS TICKETS unless you want to stay in line with hundreds of people for hours just to play a small game.

Another thing is, if you have plan to go to USS, don’t forget to visit Steven Spielberg movie room (in New York road) and Water World (near Jurassic Park).

20170718_104223

Scifi area at USS

20170718_104837

Mystery Egypt

20170718_130549

Water World

At the afternoon, we went to SEA Aquarium.

20170718_153627

SEA Aquarium

20170718_155132

SEA Aquarium 2

20170718_155231

SEA Aquarium 3

And sat in Marina Bay at night to listen to water music on the side of Marina Sand Bay.

Photo 18 45 17, 18-07-2017

Night at Marina Bay

Photo 19 01 27, 18-07-2017 (1)

Night at Marina Bay 2

Day 3: THE DAY OF NATURE

On the third day, we decided to visit Garden by the Bay.

Photo 07 48 18, 19-07-2017 (1)

Dragonfly garden

Photo 08 12 20, 19-07-2017 (1)

The sky forest

Photo 08 45 08, 19-07-2017

The flower dome

At the afternoon, we went to Art Science Museum.

20170719_161550

A copyright of “Principia” at Art Science Museum

20170719_162055

Art Science Museum

And visit Marina Sand Bay.

20170719_204355

At DC commic store

20170719_204447

At DC commic store 2

About 6.30pm, we came back to Garden by the Bay to enjoy Super Tree Rhapsody. The Rhapsody often begins at 7.00pm and end up after 15 minutes. So, if you go to Singapore, don’t forget the time of Rhapsody. It will be a memorable experience for you.

20170719_194848

SuperTree Rhasody

20170719_194853

SuperTree Rhasody 2

Day 4: BOOKSTORES – NOT ONLY FOR NERD

On the final day, we went to Kinokuniya which is the largest bookstore in Singapore, bought some good books and came back to the hostel to check-out at 12.00pm.

20170720_091937

On the way to the book store

Then, we went to the airport to come back to Vietnam.

It is really a fantastic trip that left lots of memories on me and my friend. Good bye Singapore and see you again!

From an unforgettable experience,

Curious Chick

Advertisements

[PROJ 3] KINECT SCANNER

When I was in the third year at university, our team was assigned to a small project that required to design a Kinect scanner in order to implement 3D model of things. To simplify the task, we used the software Kinect SDK beta to construct the 3D model. At rest, we built electrical and electronic system, desgin mechanical system, built a prototype and control it.

To control the prototype, we decided to use open loop control as you can see in Fig. 1.

proj3_1

Fig. 1 Open loop control system

The prototype is showed in Fig. 2.

proj3_2.png

Fig. 2 The prototype of Kinect scanner

Honestly, the purpose of design was just for things whose weight lie in the range from 1 to 2.5kg. We used a box to test and the results are showed in Fig.3 and Fig. 4.

proj3_3.png

Fig. 3 3D model of the box

Exporting STL file for 3D printer.

proj3_4.png

Fig. 4 STL file of the box

If you enjoy the project, feel comfortable to contact me for more detail.

 

From an old story,

Curious Chick

LINEAR REGRESSION (1) – MATRIX INVERSE APPROACH

Hi everybody,

Today, I would like to talk about the linear model for regression task in this post. While you have seperate labels (which may be (0 and 1) or (-1 and 1)) in classification tasks, the outputs in regression are continuous (i.e. they are arbitrary numbers lie in particular ranges). Continue reading “LINEAR REGRESSION (1) – MATRIX INVERSE APPROACH”

MACHINE LEARNING – WHAT IS THE DATA TELLING YOU?

Hi everyone,

Once I mention the concept of Machine Learning (ML) to my friends, who doesn’t work in the discipline of technology or data science, at least one of them think that it may be related to some characters on sci-fi like The Terminator, Wall-E, or recently, Ultron. In fact, it is partly true, that ultimately, the final purpose of ML is to make a robot that can be able to think and do like human beings, but now, it seem to be used mainly for analyzing data and getting information from it.

Nowadays, lots of technical companies have been bringing researches to the life (Natural Language Processing (NLP), Pattern Recognition, etc.), many businesses also used ML to analyze their customer and stock stock, and it can be said that ML become one of the sexist field in the world. Basically, there is two types of ML: supervised and unsupervised learning (see Fig. 1). For supervised learning, you need a datasets including input and output to train your algorithms, it is used for regression or classification tasks. By contrast, unsupervised learning don’t need output to train and it is used for dimensionality reduction or cluster tasks. For more details about ML, you can refer to these references [1], [2].

ml_family

Fig.1 Two types of Machine Learning

Actually, learning ML is not as tough as you can think and if you just stay at using it, it is no more than a tool. The hardest works is that how to collect and preprocess the data before you feed it into ML algorithms. Each discipline have their own way to do that. For example, speaking from personal experience in building Brain – Computer interface systems (BCIs), the data in this case is EEG signal which is acquired from the scalp. Firstly, for data collection stage, what you need to do before collecting signal is to ask yourself some question to consider the purpose of collecting data, kind of what is the sampling rate you want to design the suitable hardware? Which position is chose to collect signal on your scalp to select the number of electrodes? etc. Secondly, for the preprocessing stage, of course, the raw data often have a lot of noise, so you need to use filters to denoise your datasets after that, then extract features into a feature input vector and feed it to ML algorithms. I can say that feature extraction is one of the most creative work when you try to analyze the data, and it require several knowledge about the field you work in. For example, come back to the field of BCIs, you may use some common descriptive statistics such as mean, median, standard deviation, etc. as features of data, but if you know a little bit about how your brain works, like the magnitude of alpha will increase and that of beta decrease when you are relax or in meditation, blah blah, and instead of statistical features, you now use the energy of alpha and beta from every electrode to make feature vector, it will be more efficient (not only decrease the size of feature vector but also increase the classification results). OK, you see that a lot of things to do before using ML. However, these works are beyond of this topic, so I will not discuss more.

In this series, I just focus on some popular algorithms in both supervised and unsupervised learning to help us solve some basic problems. And as I mentioned before, even your work is out of the field of technology, but if you are interested in ML, you can also learn and discuss it.

On the other hand, all codes in this series will be implemented using Scikit-learn and TensorFlow. A little bit about TensorFlow, it is low-level library which is more complicated than Scikit-learn to be used to implement ML algorithm. However, I would like to use it in some of my real projects because it is more efficient. The reasons of this is that TensorFlow sources was built by using C. Moreover, a computational graph is needed to drawn before running the ML algorithms. These help TensorFlow run much faster than Scikit-learn. Actually, there is other libs like Theano using the same ideas as TensorFlow but I would rather using it. It depends the taste.

Another thing is how to install TensorFlow? If you use Ubuntu or MAC OS, it wouldn’t be problem, prefer to [3] and [4] to get how to install it. However, there is a problem when you try to install TensorFlow in your Windows computer. The problem is that, TensorFlow is only support for Python 3.5.* on Windows. I tried it and it seemed not to work as expectation. For example, I wrote a simple code that print ‘Hello World’ to the screen using TensorFlow, but the line that is printed on the screen respond for byte instead of string type.

tensorflow_hello

Fig. 2 TensorFlow on Python 3.5

On the other hand, as I mentioned in the first tutorial in the series of Basic Python Tutorial, there are some important libraries that cannot be used on Python 3.5.* such as Scipy. Thus, to solve this problem, I use Ubuntu on Virtual Machine. The instruction to install Virtual Machine is described on [5].

How to install Ubuntu on VirtualBox in Windows [5]

OK, so have you set up all need of software on your computer for ML? In the next tutorial, we will familiar to the simplest ML algorithms called Linear Regression.

Hope you enjoy it,

Curious Chick

References

[1] https://www.toptal.com/machine-learning/machine-learning-theory-an-introductory-primer

[2] https://monkeylearn.com/blog/gentle-guide-to-machine-learning/

[3] https://www.tensorflow.org/install/install_mac

[4] https://www.tensorflow.org/install/install_linux

[5] https://www.youtube.com/watch?v=GGorVpzZQwA

[PyTUT 5] ARRAYS IN PYTHON

Hi everyone, in this tutorial, I want to introduce another type of data in Python – array.

Related topics

Before beginning this tutorial, I recommend you should read the following topics:

[PyTUT 2] NUMBERS AND OPERATORS

[PyTUT 3] STRINGS

[PyTUT 4] VARIABLES AND COMMENTS

If you have already read these, let’s start to know what is array and what is it used for?

Introduction

Some of you may know that array is an useful type of data that permits programmers to store sets of information in one variable and to do the same thing with each element of it. This helps you to avoid making a lot of duplicated code. For example, assume that you want to store test scores of 5 students and then calculate the average test score of them. So, how could you do that? Here is 2 ways, let’s open IDLE and follow me.

Code 1

>>> student1 = 7.5
>>> student2 = 9.0
>>> student3 = 8.5
>>> student4 = 8.5
>>> student5 = 10.0
>>> average_score = (student1 + student2 + student3 + student4 + student5)/5
>>> print average_score
8.7

Well, everything seem to be more effective when using array.

Code 2

>>> student_scores = [7.5, 9.0, 8.5, 8.5, 10.0]
>>> average_score = sum(student_scores)/len(student_scores)
>>> print average_score
8.7

OK, in the example above, you saw how useful is it when using array instead of declaring a lot of variables. And it will be more effective to use array when the number of students (in the example) increase to n, with n is extremely large.

Now, let’s continue to know how to create an array in Python.

If you used to program in C/C++ or other compiled programming languages such as Java and C# before, you could know the popular structure below to create an array:

type variable_name = {value 1, value 2, value 3, ... , value n}

The compiled programming languages use braces {} to declare array of values, and you have to put the ‘type of variable’ before ‘variable’s name’. And of course, because the array have its type, the values in which must respect to the type of the array. It means if you declare the type of array string, all values in array must be string data type. Similarly, you must put integer (or float) values into your array, if you declare its type integer (or float). It sounds a bit complicated.

In Python, you don’t have to declare array data type. Instead of that, Python will consider the array data type by looking at the type of the value in array. Moreover, you can put any type of value in an array (like the code below). What a powerful weapon!

>>> iron_man = ['Tony Stark', 38, 1.82, 83, 'billionaire', 'play-boy']

However, there are some discrepancies between Python arrays depending on which kind of arrays you use. Let’s take a look through typical types of array in Python.

List

  • Creating a list

In Python, we use square bracket [] to make a list and commas to separate individual elements. For example:

>>> student_name = ['harry potter', 'ron westly', 'hermione granger']
>>> student_weight = [54, 60, 43]
  • List index

Index is an essential part of array. It is used to access elements in an array. For example, accessing the score of the third student in ‘student_scores’ array from previous example.

>>> print student_scores[2]
>>> 8.5

Remember that, index is counted from 0, so you use index 0 for the first element, 1 for the second one, 2 for the third one, and so forth.

On the other hand, you can use a negative number to be an index of a list. In this case, the index will be counted from the right, begin from -1.

>>> print student_scores[-1] 
>>> 10.0
>>> print student_scores[-2] 
>>> 8.5

In addition, you can access more than one elements from the index m to (n-1) by using the structure below:

>>> print array_name[m, n]

For example:

>>> print student_scores[1:3]
>>> [9.0, 8.5]
  • Updating an element in a list

To update an element in a list, you just simply call its index in the list and change its value. Look at the example below to see how is the score of the third student changed.

>>> print 'The score of the third student is: %.1f' %student_scores[2]
>>> The score of the third student is: 8.5
>>> student_score[2] = 9.5
>>> print 'The new score of the third student is: %.1f' %student_scores[2]
>>> The new score of the third student is: 9.5
  • Deleting an element in a list

There are many ways to delete an element in a list. You can delete an element by using ‘del’ command as the example below:

>>> print student_scores
>>> [7.5, 9.0, 9.5, 8.5, 10.0]
>>> del student_scores[2]
>>> print student_scores
>>> [7.5, 9.0, 8.5, 10.0]

Or you can use the built-in methods ‘remove’ to delete an element if you want to delete the exact value that you knew in the list. In the example below, I want to delete the value 7.5 in the list ‘student_scores’.

>>> print student_scores
>>> [7.5, 9.0, 8.5, 10.0]
>>> student_scores.remove(7.5)
>>> print student_scores
>>> [9.0, 8.5, 10.0]
  • Adding an element into a list

To add an element into a list, we use append() which is a built-in methods of list to add the element into the end of the list.

>>> print student_scores 
>>> [9.0, 8.5, 10.0]
>>> student_scores.append(9.5)
>>> print student_scores 
>>> [9.0, 8.5, 10.0, 9.5]

On the other hand, you can use insert() which is also a built-in methods of list to add the element into any position you want in the list.

>>> print 'The score of the third student is: %.1f' %student_scores[2]
>>> 10.0
>>> student_scores.insert(8.0, 2)
>>> print 'The score of the new third student is: %.1f' %student_scores[2]
>>> 8.0
  • Basic List Operations

Similar to strings, we can use addition operator + and multiplication operator * to concatenate and repeat lists, respectively.

>>> a = [1, 2, 3]
>>> b = [4, 5, 6]
>>> c = a + b
>>> print c
>>> [1, 2, 3, 4, 5, 6]
>>> d = a*3
>>> print d
>>> [1, 2, 3, 1, 2, 3, 1, 2, 3]
  • Useful Built-in methods for number list

Now, you are able to do a lot of things with lists. However, I want to show you a little further with some useful built-in methods which are often used to treat a list of number. I will illustrate these methods with the ‘student_scores’ example above.

>>> print 'The number of student:'
>>> The number of student:
>>> print len(student_scores)
>>> 5
>>> print 'The highest score:'
>>> The highest score:
>>> print max(student_scores)
>>> 10.0
>>> print 'The student who have the highest score: '
>>> The student who have the highest score:
>>> print 'Student number %d' %(student_scores.index(max(student_scores))+1)
>>> Student number 4
>>> print 'The lowest score:'
>>> The lowest score
>>> print min(student_scores)
>>> 8.0
>>> print 'The student who have the lowest score:'
>>> The student who have the lowest score:
>>> print 'Student number %d' %(student_scores.index(min(student_scores))+1)
>>> Student number 3
>>> print 'The number of student who get 9.0 in the examination: '
>>> The number of student who get 9.0 in the examination:
>>> print student_scores.count(9.0)
>>> 1
>>> print 'The order of the scores from low to high'
>>> The order of the scores from low to high
>>> print student_scores.sort()
>>> [8.0, 8.5, 9.0, 9.5, 10.0]
  • Dimension of a list

In the previous examples, we created 1D dimension list, now try to create a higher dimension list by adding a list into another lists.

>>> 1d_list = [1, 2, 3] # 1D list with shape [3]
>>> 2d_list = [[1, 2, 3], [4, 5, 6]] # 2D list with shape [2, 3]
>>> 3d_list = [[[1], [2], [3]], [[4], [5], [6]]] # 3D list with shape [2, 3, 1]
>>> print 3d_list[0][1][0]
>>> 2

High dimension lists seem to be unfamiliar now, but you will probably work a lot with it in the future if you expect to work in the field of image processing.

Tuple

Tuple is known as immutable list. It means you cannot change, append or delete the value of elements in tuple.

To declare a tuple, we use parentheses () instead of square brackets [].

>>> countries = ('Vietnam', 'America', 'Germany', 'France', 'Canada')
>>> first_eleven_fibonacci_number = (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89)

Most built-in methods or operations which are used in list can also be used in tuple.

>>> print max(first_eleven_fibonacci_number)
>>> 89
>>> print sum(first_eleven_fibonacci_number)
>>> 232
>>> k = countries + first_eleven_fibonacci_number
>>> print k
>>> ('Vietnam', 'America', 'Germany', 'France', 'Canada', 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89)

However, as I mentioned before, you cannot change, append or delete in tuple. If you try to do it, you will get errors.

>>> first_eleven_fibonacci_number[4] = 99

Traceback (most recent call last):
 File "<pyshell#39>", line 1, in <module>
 first_eleven_fibonacci_number[4] = 99
TypeError: 'tuple' object does not support item assignment
>>> del first_eleven_fibonacci_number[7]

Traceback (most recent call last):
 File "<pyshell#40>", line 1, in <module>
 del first_eleven_fibonacci_number[7]
TypeError: 'tuple' object doesn't support item deletion

Dictionary

In the final section, I would like to introduce another type of arrays in Python – dictionary.

pytut5

Fig. 1 Structure of a dictionary

A dictionary which is declared by using braces {} include keys and values as Fig. 1. The keys are used to connect to and access values. The values can be numbers, strings, lists, or even dictionaries.

>>> satre = {'name': 'Jean-Paul Satre', 'aged': 74, 'country': 'France', \
             'works': ['Le mur', 'Les mouches', 'Le sursis']}
>>> print '%s died in Paris, France, aged %d' %(satre['name'], satre['aged'])
>>> Jean-Paul Satre died in Paris, France, aged 74
>>> print 'Three of his famous books are:'
>>> Three of his famous books are:
>>> print satre['works'][0]
>>> Le mur
>>> print print satre['works'][1]
>>> Le mouches
>>> print print satre['works'][2]
>>> Le sursis

Most things you can do with lists and tuples, you can also do with dictionaries but you need to use key instead of index.

>>> print 'Deleting Satre's age'
>>> Deleting Satre's age
>>> del satre['age']
>>> print 'The amount of information about Satre: %d' %len(satre)
>>> The amount of information about Satre: 3

However, you cannot use operator such as + or * for dictionaries as lists and tuples. On the other hand, to add a new key-value into the dictionary, you cannot use append() method. Instead, you can do this.

>>> satre['philosophy'] = 'Existentialism'

So, with all basic things I introduced, you are now able to do a lot of things with arrays in Python. In the next tutorial, I will introduce control structures and we will try writing the first script in Python.

 

Hope you enjoy it,

Curious Chick

[PyTUT 4] VARIABLES AND COMMENTS

Hi everybody, this is a small tutorial I want to show you before introducing arrays in Python because we will use it in the next tutorial.

Related topics

[PyTUT 2] NUMBERS AND OPERATORS

[PyTUT 3] STRINGS

Variables

To put it simply, we can think of a variable as a name of a value which can be a number, string, list, tuple, or even dictionary. In fact, every time when we declare a variable, the interpreter will allocate memory for its value.

A value can be assigned to a variable by using equal sign = and it can be any type of data such as number, string, or array data type in Python (list, tuple, and dictionary).

>>> a = 8
>>> b = 9.0
>>> c = float(a)
>>> print c
>>> 8.0
>>> d = 'Hello '
>>> e = 'Adele'

To access a value from a string or number type variable, we simply call and perform operations with its name.

>>> s = a + b
>>> print s
>>> 17.0
>>> st = d + e
>>> print st
>>> Hello Adele

See that, whatever you can do with 2 numbers or 2 strings, you can also do with 2 variables which stores 2 numbers or 2 strings.

However, it is different when accessing value from array data types in Python. In the next tutorial, I will introduce to you how to deal with it.

Comments

Sometimes, you may make a long code in your project and it will be tough to work with it again after a long time if you don’t note the meaning of parts in your program. That’s why we need to use comments in our program. A comment is made by putting a hash mark # before a message.

>>> theta = 5.0 # initializing theta
>>> bias = 1.3 # initializing bias
>>> x = 2 # initializing variable
>>> y = theta*x + bias # estimating the model

Although all comments are ignored by Python interpreter, it is an crucial part in a Python program. The more you make good comments in your code, the more you save your time.

That’s all. Is it easy?

In the next tutorial I will introduce array data types used in Python. Well, it will be a long tutorial and you will have a lot of things to do.

 

Hope you enjoy it,

Curious Chick

[PyLIB 1] HOW TO INSTALL LIBRARIES IN PYTHON

Hi everybody, following to the series of ‘Basic Python tutorials’, today I want to open another series to introduce Python libraries which are silver bullets that help you improve your weapon to tackle your problems.

In the first tutorial, I will introduce a setup tool called ‘pip’ to help you easily install a Python library and an example of it.

Introduction

As I mentioned before, a feature that makes Python become one of the most powerful weapons is the diversity of libraries. There are many Python libraries which were developed to help developers, scientists, etc to solve their problems quickly and most of them are open-source. So, “you don’t have to reinvent the wheel again, unless you plan on learning more about the wheels” [1].

There are many ways to install a Python libraries. You can install the libraries using .exe or .py file from the library web or using text editor, too name but a few. For me, I prefer to use ‘pip’.

So, what is ‘pip’? It is a package management system that you can use to install, upgrade, and manage libraries or packages in Python [2].

Do you need to install ‘pip’?

If you have Python 2>=2.7.9 or 3>3.4, you will not need to install ‘pip’ and setup-tools because it already install in your Windows along with Python [3]. So, in this case, what you need to do is to upgrade your ‘pip’ to the latest version.

Step 1: Type ‘run’ in search tools of Windows to open ‘run box’.

run_search

Fig. 1 Open run box

Step 2: In ‘run box’ type ‘cmd’ and click ‘OK’ to open ‘Command Prompt’

run_box

Fig. 2 Type ‘cmd’ in ‘run box’ to open ‘ Command Prompt’

Step 3: In ‘Command Prompt’ type:

python -m pip install -U pip setuptools

to upgrade ‘pip’.

For another operating systems, you can find more information on installing ‘pip’ on [3].

Examples

OK, let’s do a warm-up exercise by trying installing ‘matplotlib’ package (which is a graphic library that help user to visualize or plot the graph).

In the first step, you have to open ‘Command Prompt’.

Next, type

pip install matplotlib

and the installing process begins.

This process may take a while. After that, if you get ‘Successfully installed …’. You have already installed this library.

Troubleshooting

In some cases, you may encounter a problem showed in Fig. 3 when you try to upgrade your pip or install lib using pip command.

error

Fig. 3 An error occurs when Python was not added into “Path”

The problem caused by Python was not added into ‘Path’ when you installed Python. So, the Command Prompt don’t understand what pip means.

To tackle this, follow these steps sequentially:

Step 1: Right click “This PC” and select “Properties” (see Fig. 4).

step1

Fig. 4 Open “System” dialog

Step 2: A “System” dialog appears. In which, click “Advanced System settings” (see Fig. 5).

step2

Fig. 5 Click “Advanced System settings” to open “System Properties” dialog

Step 3: In the “System Properties” dialog, click “Environment Variables” (see Fig. 6).

step3

Fig. 6 Click “Environment Variables” to configure system variables

Step 4: In the “Environment Variables” dialog, look for “Path” under the “System variables” window and double click on it (see Fig. 7).

step4

Fig. 7 Double click on “Path” which is under “System variables” window

Step 5: In the “Edit Environment Variable” dialog, click “New” and type “C:\Python27” and then click OK (see Fig. 8).

step5

Fig. 8 Steps to add Python into Path

Step 6: Now, you can try to upgrade pip or install lib using pip command again and see the difference.

In the next tutorial, I will introduce numpy which is one of the most useful package that help user to handle mathematical elements such as vector, matrices, etc.

 

Good luck and hope you enjoy it,

Curious Chick

References

[1] https://blog.codinghorror.com/dont-reinvent-the-wheel-unless-you-plan-on-learning-more-about-wheels/

[2] https://en.wikipedia.org/wiki/Pip_(package_manager)

[3] https://packaging.python.org/tutorials/installing-packages/