Python Data Analysis [duplicate] - python

This question already has answers here:
Install a module using pip for specific python version
(17 answers)
Closed 5 years ago.
I am new to python. I have various versions of python installed in my Mac.
The pandas is installed in python 3.5. I want to use python 2.7. However when I do
import pandas
It says:
ImportError: No module named pandas
I tried pip install pandas but it is installing in python3.5
Can anyone suggest me how I can install modules for specific python
Tanya

I would suggest you to create a virtual environment and get started with the Python version you want to work on. Link to Documentation
You may also follow easy instructions for getting your choice of Python version on IPython Notebook as well. You may follow Step 1-4 in this documentation for virtual env and Python 2.7

Related

How to create virtual environments with different Python versions [duplicate]

This question already has answers here:
Use different Python version with virtualenv
(41 answers)
Closed 1 year ago.
I am very new to Python. I am trying to install a library called Mesa (https://mesa.readthedocs.io/en/master/index.html) in a virtual environment, but each time I try to clone the repository I get the error message: An error occurred while installing pandas==1.2.4
I believe the problem is that I have installed Python 3.9, but Mesa works with Python 3.7. I have installed Python 3.7 on my computer also, but do not know how to make a virtual environment which runs Python 3.7.
I have virtualenv installed but this is as far as I have gotten... very specific answers would be much appreciated as I still don't really know what I am doing!
From my experience the easiest way is using Anaconda and creating environments with specific versions inside it. https://www.anaconda.com/
The second way I use is google colab its really fast if I just want to check something on different version and requires no setup just lunch it from your google account
With python3.8:- virtualenv -p python3.8 env_name
replace python version like python3.9, python3.7..

How to use opencv module in python(I'm using pycharm) [duplicate]

This question already has answers here:
Cannot find module cv2 when using OpenCV
(24 answers)
Closed 2 years ago.
Thanks to read my question.
I got homework to print figures and try to use opencv module.
I search internet and download opencv by using cmd.(pip install opencv-python)
But in pycharm, I can't use opencv module.
Error massage tells me
ModuleNotFoundError: No module named 'cv2'
I don't know about programming well, It's hard to me guess reason.
Some theory is my code file is in D drive, not C drive which pycharm or python is install.
If you have python version 3 and above:
pip3 install opencv-python
If you have python version 2 and above:
pip install opencv-python
If you have used these commands and installed the package successfully, there is a good chance that your pycharm is not using the python version that you have installed this package on.
If you just want to be assured that you have installed the package correctly use
pip list
and check if the opencv-python is in the list. If you are seeing this package in the list you should check the version of your pycharm python interpreter.
Checkout this link for more information:
https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html

different versions of python in one mac, how can I open a specific version among them? [duplicate]

This question already has answers here:
Dealing with multiple Python versions and PIP?
(28 answers)
Closed 6 years ago.
I just started learning python and while I tried to follow several examples, I installed different versions of python in my mac.
I found out there are already python in my mac later, and I did not consider it seriously.
Anyway, I tried to do something with idle, or python 3.5, and it does not have bumpy module.
I then tried to install the module so I opened a terminal and "pip install bumpy:"
it says it already has that in python2.7
Are there ways that I can do pip install thing in terminal into python3.5?
Thanks a lot.
Sincerely,
Jaeho
Try using pip for 3.5:
pip3.5 install bumpy

How do I update/change version of Python? [duplicate]

This question already has answers here:
How to update Python?
(4 answers)
Closed 6 years ago.
I am new to programming. I have installed python 3.5.1 on my windows 10 64-bit machine. I have installed a few modules using pycharm. Since Python 3.5.2 has come out, should I update to 3.5.2? If yes how? Will my installed modules retain?
If you have installed anaconda than you can run this command:
conda update python
This will update your python to latest version.
Updating Python each time when it brings out new version isn't necessary, you shall look into https://docs.python.org/3.5/whatsnew/changelog.html#python-3-5-2 if there is some useful stuff for you do it, but as I said it isn't necessary.

Why ipython Anaconda does not recognize my omdb import? [duplicate]

This question already has an answer here:
Anaconda not finding my packages installed with `pip`
(1 answer)
Closed 6 years ago.
I am having some issues understanding what is happening with the installation of omdb module in my computer (https://github.com/dgilland/omdb.py).
I installed via Terminal using:
pip install omdb
Then I created a simple python script to test if it would import correctly:
import matplotlib
import omdb
print omdb.get(title='A Beautiful Mind', fullplot=True, tomatoes=True)
The script ran perfectly when I used python in terminal:
python movies.py
but then I tried to use my ipython with Anaconda, and I would always get the following message:
ImportError: no module named omdb
Is there another way to install a module, or am I missing something about Anaconda and Python?
All I wanted was to be able to use omdb. I'm using Python 2.7.11-0 and OS X 10.9.5. Any help is appreciated
That's because Anaconda installed packages aren't stored into a Python library, it has it's own warehouse. So you should use the command for it:
conda install omdb
Anaconda comes with its own package manager named conda. It also doubles as a virtual environment manager.
The Python package manager is pip, which is only a package manager and you will have to install virtualenv in order to manage virtual environments.

Categories

Resources