For example, to get more information about the requests package that I have installed I would run the following command: → pip show requests Īnother useful command with pip is pip show, which shows you useful information about one or more packages that you have installed. Note that I have again cut the output above short after bcrypt. To demonstrate: → pip freezeīackports.shutil-get-terminal-size=1.0.0 Pip freeze lists the packages you have installed (but not their dependencies) in a format suitable for storing in a file (often called a requirements.txt file) - something that we will cover in much more detail at a later stage. I have cut the output above short after the bcrypt package because it takes up too much space, but I think you will get the idea! Pip list lists all of the packages you have installed (and their dependencies) in a human-readable format: → pip list To check which Python packages you have installed you can run two different commands in your terminal, pip list or pip freeze. To double-check your installation of matplotlib, use the following screencast: Check which packages you have installed Now, if you try and run your generate_graph.py script using python generate_graph.py, it should execute successfully and the following graph should appear:Ĭongratulations, you have successfully installed and used your first Python package, matplotlib. Installing collected packages: matplotlib Requirement already satisfied: six>=1.5 in. Requirement already satisfied: setuptools in. anaconda3/lib/python3.7/site-packages(frommatplotlib)(2.3.0) anaconda3/lib/python3.7/site-packages(frommatplotlib)(0.10.0) Requirement already satisfied: cycler>=0.10 in. anaconda3/lib/python3.7/site-packages(frommatplotlib)(2.7.5) Requirement already satisfied: python-dateutil>=2.1 in. anaconda3/lib/python3.7/site-packages(frommatplotlib)(1.0.1) Requirement already satisfied: kiwisolver>=1.0.1 in. anaconda3/lib/python3.7/site-packages(frommatplotlib)(1.18.4) Requirement already satisfied: numpy>=1.11 in. ![]() If this is the case, you need to install the matplotlib package using pip install matplotlib : → pip install matplotlib Module Not Found Error: No module named 'matplotlib' If the script doesn’t execute successfully then you may well be getting an error message similar to the following: ~Įrror processing line 1 of /Users/george/anaconda3/lib/python3.7/site-packages/matplotlib-3.0.2-p圓.7-nspkg.pth:įile "/Users/george/anaconda3/lib/python3.7/site.py", line168, in addpackageĪttributeError: 'NoneType' object has no attribute 'loader' If the command executes successfully, and the script generates a graph then great - you already have the matplotlib package installed. ![]() ![]() Now, try running the command python generate_graph.py from your command line. We are going to make use of the matplotlib package - a package that helps you draw graphs using Python.įirst, create a file called generate_graph.py and put in the following contents: import matplotlib.pyplot as plt Once you have located a Python package that you want to make use of, you can use the command pip install to install it.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |