I want to run modules such as CV2 and numpy in my code, but I don't think it will work without 32 bit Python. So I want to download 32 bit python (IDLE) but I'm not sure how to on my Mac.
Both those packages should work with all versions of python 3. You can check the version of python installed on your Mac by opening Terminal and then entering python --version. If it's python 3, you should be good to go. If you see command not found or something similar, go to the python website and download.
Next, check that pip (python's default package installer) is also installed correctly. In terminal, enter pip --version. You should see something other than command not found.
Both numpy and cv2 are python packages and will need to be imported in your code. You've likely done this already with python's native (pre-installed packages) like datetime etc. However, neither numpy nor cv2 are pre-installed packages, so you'll have to use pip to install them. Once you've confirmed pip is installed (above), enter pip install cv2 and then pip install numpy. You should then be able to import them and use them in your code
Related
I am wondering if i can install things like numpy or cv2 for the python that is bundled with lldb.
Yes, you can use pip3 just like you would for any other Python install. You just have to make sure to use the pip3 that matches the python libraries in Xcode.app that lldb will also use. To do that just invoke /usr/bin/pip3 - that binary gets installed as part of Xcode.
I have to import numpy for a project in python, and I was told to simply install it in the CMD prompt, (pip install numpy). It says it is installed, but when I try to import it in python, it says: no module named 'numpy'. What did I do wrong or how do I fix this?
If you are using python version that is lower than 3 the method you tried should work so I am assuming you have a python version of 3.x.
For that you have to use
pip3 install numpy
As pip is for version lower than python 3 but pip3 is the one for python3.
EDIT
Since you said that it works in command prompt, so I believe that the pycharm is not using python3...?
If that’s the case try visiting here and set the appropriate version.
Hope it helps
Hi if you want to ensure you are using the python and pip in the same bin and the installation of numpy is also in the same bin, you can try:
$ python -m pip install numpy
I am trying to write a simple program that uses the numpy module. I have downloaded it without the use of a virtual environment using pip. On doing a pip freeze all the modules are present yet I am unable to import it when I use the command prompt python terminal. I found a few answers related to the environment variables but I can't work my way around it.
That can be caused by multiple python versions installed in your system.
So try:
python -m pip list
and if it does not list numpy, try installing it using:
python -m pip install numpy
In some cases, py works the same as python, so try all above things with py as well, including your own attempts
I'm running OS X 10.7.5 and have been trying for weeks to get PIL working.
It installs and compiles fine, passes its selftest, and I can import __imaging without any errors.
However, when I try and use the scikit-image reading and writing functionality, which depends on PIL, I still get the classic "The imaging C module is not installed" error.
Does anyone have any idea how to debug this? I am stumped.
Try Pillow. It's a fork of PIL and has fixed many bugs and is actively developed, unlike PIL.
Mac OS X installation instructions can be found here:
Note: You do not need to install all of the external libraries to get
Pillow’s basics to work.
We do not provide binaries for OS X, so
you’ll need XCode to install Pillow. (XCode 4.2 on 10.6 will work with
the Official Python binary distribution. Otherwise, use whatever XCode
you used to compile Python.)
The easiest way to install the prerequisites is via Homebrew. After
you install Homebrew, run:
$ brew install libtiff libjpeg webp little-cms2
If you’ve built your
own Python, then you should be able to install Pillow using:
$ pip install Pillow
Also, it's best to avoid OS X's system Python and use the Homebrew version.
from this site
http://matplotlib.sourceforge.net/users/installing.html#installing-from-source
tell us that the requirement is python 2.4 or later but not python3.
Now im working with python3 and i need some plot form matplotlib.
So how to solve it?
I'm sorry, but at the current time it's not supported.
If you feel brave, you can try with the Py3k SVN branch which reportedly works with a simple example. Be aware that there has been no update in the last 8 months on this though.
Of course, you'd be more than welcome to contribute to the porting to Python 3 if you could.
You could try the unofficial versions. Check this site:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Looking at the docs at the link it says the following is a dependency:
Python (>= 2.7 or >= 3.4)
You can download a version of Python that will work at:
https://www.python.org/downloads/windows/
I would go with the most recent release and a 64 bit version as certain libraries for data analysis do not run on the 32 bit version of Python.
The version of Python you download will come with pip which you can then use to install any libraries you need to do your work.
Make sure you have set your environment variables if you want to run your programs from the command line or bash terminal.
I installed matplotlib through the bash terminal with:
pip install matplotlib
Let me know if that helps.
To install matplotlib on windows, first, you have to install pip first to install pip on windows go to website
https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip
Download get-pip.py, being careful to save it as a .py file rather than .txt. Then, run it from the command prompt:
python get-pip.py
if pip is already installed, install matplotlib by writing in command prompt:
python -mpip install -U pip
python -mpip install -U matplotlib