Matplotlib installation for python 3.6. and windows 8 - python

I do not understand exactly what I should do to install Matplotlib. I read a lot of posts but I do not have so much of fluent knowledge in programming so basically all of this that i read is quite confusing. Does anyone know what exactly should be done when having Python 3.6., visual code studio and Windows 8 to install Matplotlib?

A way that is simple using the original python from python.org with PATH installed is to use pip. You can check by opening cmd and entering python. If it is not a recognised command then you will have to reinstall python but make sure to tick the box at the start to enable PATH. once this is done you can install packages such as numpy and matplotlib.
In cmd type pip install Then the package you want to install from the PyPI website and using the EXACT name in the url before the version number. It should be like: /PACKAGE/VERSION.
eg. for matplotlib the url is /matplotlib/VERSION, so the name would be matplotlib. To install the latest version pip install matplotlib
If for some reason you want to uninstall a package you would do: pip uninstall PACKAGE. To install a specific version use pip install PACKAGE==VERSION where VERSION is the exact version name in the url. For full documentation visit Packaging Help.
Visual code studio is not necessary in this situation. This question is too broad and asking for a recommendation on software. Because of this, I went with the original python installation way and not any 3rd party software.

Related

problem installing and importing modules in python

I am installing python on windows10 and trying to install the opencv and numpy extentions in the command window. I get no error installing them and it says it is successfully installed. But when I try to check the installation and import cv2 it does not recognize it and give me the error: no module named cv2.
can anybody help me with this problem? Is there something wrong in installation process or do I need to install something else?
I checked the newest version of each and used the compatible one with my system.
Thanks.
One solution could be that you have 2 versions of python. So, go to the specific python's scripts directory and run: pip install numpy
If that too doesn't work, you can find the answers to this question on Why can't I import opencv3 even though the package is installed?, as stated by #Cut7er.
I have tried the solutions given to the above stated question myself also. But, they didn't work for me. So, another thing that you could try to use is this IDE called PyCharm. It ofcourse is much more beautiful that the IDLE, but it also has an inbuilt GUI controlled installation of binaries or packages. That would make things a lot easier. I have faced a lot of issues with packages for python and this IDE made things a lot easier. You can find it on https://www.jetbrains.com/pycharm/download/#section=windows.
You can also use anaconda. But, I found it a little difficult to use since, it has similar issues.
EDIT:
Seems like you are using PyCharm. But, you are installing libraries from your command prompt. So, see the answer to: ImportError: No module named 'bottle' - PyCharm. This answer guides you through how to install a certain library through your PyCharm window itself. So,
1) Go to Files>Settings
2) Search for "Interpreter" from the searching tab. Open the interpreter
3) You can now see a plus sign on the right. A click on it will open up a section on the left.
4) In the searching tab, search for numpy or opencv. Click on whichever module you want to install. And then click on the "install package" button on the bottom left. This will install the package for you.
5) Then click save. And run your file that says import cv/cv2.
This should probably do the trick.
Hope it helps!
Is it possible that you have 2 versions of python on your machine and your native pip is pointing to the other one? (e.g. you pip install opencv which installs opencv for python 2, but you are using python 3). If this is so, then use pip3 install opencv
I removed the Anaconda version on my machine, so I just have python 3.7 installed. I removed the python interpreter(Pycharm) and installed it again and the problem got fixed somehow!
I suspect you have two versions of python and the one you're using doesn't have opencv on it, because pip pointed to the wrong one.
A pragmatic solution assuming you're using the python version with conda is to just use conda to install cv2:
conda install -c menpo opencv
A more careful solution is to figure out how to get the pip that points to the python version you're using. On linux I can check that my pip points to my python like this:
:~$ which python
/home/kpierce/anaconda3/bin/python
:~$ which pip
/home/kpierce/anaconda3/bin/pip
So you see the pip and python versions are associated. On windows I suspect you do an analogous thing on the command line like
where python
where pip
And if they don't match, you might try
where python
where pip3
to see if those match. You need to use the pip that points to the correct python version. You can view the python version by entering the python interpreter and running
import sys
sys.version

Downloading, Installing, Importing libraries in Spyder for Windows 10

I am trying to run PyEphem on Spyder.
I am extremely new to Python and libraries in general.
Currently it just says that I'm running Spyder in Python 2.7.
1) I would like to run the most up to date version of Python via Spyder and then import or install Pyephem (I'm still unclear on whether I have to install the library first or not), how would I do this? I look online but its very confusing because I don't know what I need to download when I'm presented with a list of links.
2) I would also like to see an explanation of how to properly download a libary like pyephem to be incorporated into use within spyder by typing import spyder.
3) I keep reading that I need pip, but I installed the latest version of Python from the website, ran the IDLE, and type 'pip install pyephem,' as directed, but it says 'install' is invalid syntax. Then when I read that I need to type 'python -m pip install -U pip' to update pip, that is invalid syntax too
I just realized over the past 30 minutes that I'm going to need to familiarize myself with how I download and then install and then import a library for use in Spyder, or some other program that I don't know of that may be better.

How to pip install forex python

I am attempting to install forex-python. I have attempted to find a meaningful answer to this question everywhere, however my search has been in vain. Now, the Python Software Foundation's instructions are to pip install it. I am currently using Python V3.6.1 and the Foundation states that versions 3.4 or greater have pip installed directly into them. I am using the executable installer of v3.6.1.
My question is this: where do you pip install this package on Windows? I attempted to install the package in the python command prompt, tagged Python 3.6(64 bit), using the statement
pip install forex-python
though it resulted in a syntax error.
Is the module supposed to be installed on the Python interpreter? Since I am using Windows Vista, what is the Windows version of a terminal? I am unaccustomed to a Windows operating system on a Toshiba computer and I am more familiar with Mac OS X. If there is a version, what is it called and how do I find it? And if it is supposed to be installed on the Python interpreter, why does it give a syntax error when I enter the statement?
When I asked for help, it stated all information about pip, however it did not state how to install forex-python.
I currently have forex-python downloaded on this computer, symbolized by the logo of three books. It is complete with the code, readmes and files, however, I do not know how to install it for usage in IDLE programs, like my currency converter.
I would be very grateful for any help on this subject.
you can try
pip install forex-python
or
pip install git+https://github.com/MicroPyramid/forex-python.git
then you can check the installation through
pip freeze
if it is listed in it then it is installed

How to install module and package in python

I'm trying to start with OpenCV with python. I have experience c# and I have knowledge of c++. However, I feel more comfortable with python instead of c++. I installed OpenCV then python 3.4 in visual studio 2015. At the beginning I've received an error numpy, "Module couldn't be found", thankfully, I resolved it. The I got another error cv2 "Module couldn't be found" I asked an question yesterday, but I think the question has been left away. Anyways, I'm not complaining, but I still need some help please to stat with OpenCV in python.
Installing python 3.4 Successful
Installing numpy Successful
installing matpilotlib Failed
installing cv2 Failed
can anybody help me please thanks a lot.
It's very common to install Python packages through pip today (recursive acronym for pip installs packages). However, this is not that trivial under Windows.
How to install matplotlib:
Try to open a commandline and type in pip install matplotlib. If this does not work, you'll need to do some more work to get pip running. I gave a detailed answere here: Not sure how to fix this Cmd command error?.
How to install OpenCV:
The Python OpenCV DLL must be made for your version of Python and your system architecture (or, to be more specific, the architecture your Python was compiled for).
Download OpenCV for your Python version (2/3)
Try replacing the x64 version with the x86 version
There are a lot of different binaries here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv. Try to get the one exactly matching your Python version and System architecture and install it via pip (cp35 means CPython version 3.5 ect.).
If you have the OpenCV .whl file matching your system configuration, do pip install file.whl.
Hope this helps!
You can install matplotlib using pip (which is already installed on your machine - mentioned in your previous quesiton):
pip install matplotlib
more info:
http://matplotlib.org/faq/installing_faq.html
You may be better off using an package such as pythonxy as a start, e.g. from https://python-xy.github.io/ , instead of installing each single package manually.

Having troubles installing GDAL for Python

I am still pretty new to python, and I was wondering if anyone has had this problem before. I have read other threads, but I haven't seen this problem addressed yet. I need to install the GDAL module for python, and I have seen threads saying you need to install GDAL first and then it can be used on python, but I have also see others that said that conda install GDAL is enough. When I try the latter, I get this error. Any ideas?
I had the same problem two days ago trying to install GDAL on Debian Jessie.
The solution was using pygdal python package from PyPi.
Just read the instructions at PyPi and follow them, they are a bit different then one expects. In general:
install required dependencies into your system (e.g. using apt-get install libgdal1-dev
check, what version of GDAL is installed
use pip to install pygdal with a version matching the installed GDAL lib.
The last step is a bit unusual, but does the trick.
This works for Linux. For Windows my colleagues claim, there are ready made binaries, which can be installed.

Categories

Resources