Sunteți pe pagina 1din 10

MS-DOS commands and below is a description of how to use them.

cd -- Change directory or display current directory path.


cls -- Clear the window.
dir -- Display list of contents of current directory.
help -- Display list of commands or help about a command.
notepad -- Run the Windows Notepad text editor.
type -- Displays the contents of a text file.a
assoc -- Displays or modifies filename extension associations.
attrib -- Displays or changes file attributes.
call -- Calls one batch program file from another.
chkdsk -- Checks a disk and displays a status report.
chkntfs -- Displays or modifies the checking of disk at startup.
color -- Sets the text and background colors.
comp -- Compares the contents of two files or sets of files.
copy -- Copies one or more files to another location. See also-- xcopy
date -- Displays or sets the computer's date. See also-- time
del (or erase) -- Deletes one or more files.
defrag -- Defragment the specified storage device.
doskey -- Display command history; define macros.
echo -- Displays messages, or turns command echoing on/off.
edit -- Runs the MS-DOS text editor. See also-- notepad
exit -- Closes the MS-DOS window.
fc -- Compares two files or sets of files and displays the differences.
find -- Searches for a text string in a file or files.
findstr -- Search for a regular expression text string in a file or files.
goto -- Used in a batch program file to jump to a particular line.
if -- Used in a batch program file to perform conditional testing.
md (or mkdir) -- Creates a directory.
more -- Displays the contents of a file one screen at a time.
move -- Moves one or more files from one directory to another directory.
rd (or rmdir) -- Removes a directory.
rem -- Used in a batch program file to identify comments.
ren (or rename) -- Renames a file or files.
sort -- Sorts input.
start -- Starts a new window to run a specified program or command.
time -- Displays or sets the computer's time. See also-- date
tree -- Graphically displays the directory structure of a drive or directory.
xcopy -- Copies files and directory trees. See also—copy
Steps to upgrade PIP in Windows
(1) First, type Command Prompt in the Windows search box:

(2) Right click on the Command Prompt, and then select Run as administrator (by running
the Command Prompt as an administrator, you’ll avoid any permission issues):

(3) In the Command Prompt, type “cd\” to ensure that your starting point has only the drive
name:

(4) Press Enter, and you’ll see the drive name C:\>

(5) Locate your Python application path, which is the folder where you originally installed
Python.

In my case, the Python application path is:

C:\Users\Ron\AppData\Local\Programs\Python\Python37-32
Once you retrieved the Python application path, type the following command in the
Command Prompt:

“cd” and then your Python application path

In my case, I typed:

(6) Press Enter, and you’ll see:

(7) To upgrade PIP, type/copy this command, and then press Enter:

python -m pip install --upgrade pip

This is how the command would look like in the Command Prompt:
(8) You’ll notice that the latest version of PIP will be installed:

Steps to check the version of PIP


To check the version of PIP at any time, you’ll need to use the Python Scripts path, rather
than the Python application path.

(1) First, type “cd\” to ensure that your starting point has only the drive name:

(2) Then, locate your Python Scripts path. The Scripts folder should be located within the
Python application path.

In my case, the Python Scripts path is:

C:\Users\Ron\AppData\Local\Programs\Python\Python37-32\Scripts
(3) Type “cd” followed by the Python Scripts path (then press Enter):

(4) Finally, type the following command to check the version of PIP:

pip --version

(5) Press Enter, and you’ll see the PIP version:

Simple tool to upgrade PIP in Windows


In this section of the tutorial, I’ll share with you the code to upgrade PIP using a simple tool I
created.

Note that you’ll need to add Python to Windows path in order to start using the tool.

Here is the complete Python code:

import os
import tkinter as tk

root= tk.Tk()

canvas1 = tk.Canvas(root, width = 300, height = 350, bg =


'lightsteelblue2', relief = 'raised')
canvas1.pack()

label1 = tk.Label(root, text='Upgrade PIP', bg = 'lightsteelblue2')


label1.config(font=('helvetica', 20))
canvas1.create_window(150, 80, window=label1)

def upgradePIP ():


os.system('start cmd /k python.exe -m pip install --upgrade pip')

button1 = tk.Button(text=' Upgrade PIP ', command=upgradePIP,


bg='green', fg='white', font=('helvetica', 12, 'bold'))
canvas1.create_window(150, 180, window=button1)
root.mainloop()

Simply, run the code, and then press on the button ‘Upgrade PIP’ and you should be good to
go.

Now, what if you’d like to revert back to a previous version of PIP?

You can easily downgrade to a previous version of PIP by following the steps below.

Steps to downgrade PIP to a previous version


(1) Get to the Python application path. If you are currently set to the Python Scripts path, you
can simply type “cd..” (and then press Enter), and you would revert back to the Python
application path:

(2) Let’s say that you want to downgrade the PIP version to 18.1

To do that, simply type the following command, and then press Enter:

python -m pip install pip==18.1


(3) You should now see the version of PIP that you specified:

Final Words
If you’re using Anaconda, you may want to check this tutorial that explains how to upgrade
PIP in Anaconda.

Finally, if you need to install PIP, you may wanna review the pip documentation.
Installing Packages: In Python

Head over to https://www.python.org/downloads/ and download the installer. The default


Python Windows installer is 32 bits and this is what I will use in this article. If you need the
64 bits version of Python, check the Looking for a specific release? section from the above
page.

Start the installer and select Customize installation. On the next screen leave all the optional
features checked. Finally, on the Advanced Options screen make sure to check Install for all
users, Add Python to environment variables and Precompile standard library. Optionally,
you can customize the install location. I’ve used C:\Python37. You should see something like
this:

Press the Install button and in a few minutes, depending on the speed of your computer, you
should be ready. On the last page of the installer, you should also press the Disable path
length limit:
Now, to check if Python was correctly installed, open a Command Prompt (or a PowerShell)
window. Press and hold the SHIFT key and right click with your mouse somewhere on your
desktop, select Open command window here. Alternatively, on Windows 10, use the bottom
left search box to search for cmd.

Write python in the command window and press Enter, you should see something like this:

Exit from the Python interpreter by writing quit() and pressing the Enter key.

Now, open a cmd window like before. Use the next set of commands to install NumPy, SciPy
and Matplotlib:

1 python -m pip install numpy


2 python -m pip install scipy
3 python -m pip install matplotlib

After each of the above commands you should see Successfully installed ….

Launch Python from a cmd window and check the version of Scipy, you should see
something like this:

1 C:\>python
2 Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916
32 bit (Intel)] on win32
3 Type "help", "copyright", "credits" or "license" for more information.
4 >>> import scipy as sp
5 >>> sp.version.version
6 '1.2.1'
7 >>>

Let’s try something a bit more interesting now, let’s plot a simple function with Matplotlib.
First, we’ll import SciPy and Matplotlib with:

1 import scipy as sp
2 import matplotlib.pylab as plt

Next, we can define some points on the (0, 1) interval with:

1 t = sp.linspace(0, 1, 100)

Now, let’s plot a parabola defined by the above interval:

1 plt.plot(t, t**2)
2 plt.show()

S-ar putea să vă placă și