invalid syntax error while installed tweepy in anaconda python 2.7 - python-2.7

I am very new to python and anaconda. I am trying to install tweepy using pip install command
pip install -i https://pypi.anaconda.org/pypi/simple tweepy
I had referring to this command in
https://anaconda.org/pypi/tweepy
I am getting the below error:
File "<ipython-input-3-57dd52ca9b36>", line 1
pip install -i https://pypi.anaconda.org/pypi/simple tweepy
^
SyntaxError: invalid syntax
Tried a lot searching for this, but could not find one which can solve this problem.

You're supposed to run that in your command shell, not a Python REPL.

Related

Error when i install pip in python2.7 in window

i am try to install pip for Django in python2.7(window7) when i try to run
python get-pip.py i get error in cmd.
python get-pip.py
could not find a version that satisfies the requirement pip no matching distribution found for pip
Upgrade to a newer version of python.
Refer: https://github.com/pypa/pip/issues/5357

How can I fix pip install error: 'EnvironmentError: [Errno 42] Illegal byte sequence'?

I am trying to download kivy module using pip.
When I run the pip install command, I got an error: Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence.
I already re-installed python, I am running as an administrator and I also tried to download via the wheel file. All of the above causes the same environment error.
There seems to be a bug in pip https://github.com/pypa/pip/issues/5665.
The current workaround is to run the command in silent mode
pip install kivy -q
or
pip install kivy --progress-bar=off
pip install kivy -q
(Not a solution, a workaround - This is a bug in displaying progress bar in pip. Above command hides the progress bar while installing)
Solution based on this.

ImportError: No module named bs4 on mac with Python 2.7

I'm trying to install Beautiful Soup 4.6.0 on my mac, but I keep on getting the error message below:
I have tried to install it as easy install and pip install beautifulsoup, but still keep on getting the same error message.
The terminal description is below:
in terminal, typepython -m pip install beautifulsoup
if that doesn't work, try updating pip
python -m pip install --upgrade pip
then retry the first command

No module named 'matplotlib.pyplot'; 'matplotlib' is not a package

Have found a similar issue, however haven't found proper solution.
Here's a code:
import matplotlib.pyplot as plt
plt.plot([1,2,3],[4,2,5])
plt.show()
Run, got the message:
ImportError: No module named 'matplotlib.pyplot'; 'matplotlib' is not a package
I run Linux Mint 18 with preinstalled python-2.7 and python-3.5 (I use python3), before that I was installing modules with a simple sudo apt-get install method and that worked great.
Before running this the code above, I've installed matplotlib in a usual way sudo apt-get install python-matplotlib. As it haven't worked out, started to look for solution.
Python location
which python3 /usr/bin/python3
Current Matplotlib installed
sudo find /usr | grep matplotlib /usr/lib/python3/dist-packages/matplotlib
My tries:
1) I've removed matplotlib with autoremove, and tried to make it sudo apt-get install python3-matplotlib instead. Didn't worked out.
2) Used: pip3 install matplotlib or sudo pip3 install matplotlib. Received errors like:
command python setup.py egg_info failed with error code 1 in /tmp/pip-build- ....
3) Then I found another solution:
sudo apt-get install virtualenv
virtualenv -p /usr/bin/python3 py3env
source py3env/bin/activate
pip install matplotlib
Same outcome.
Haven't tried to use import sys sys.path.append('/usr/lib/pymodules/python2.7/')(proposed in link above), but as I am not sure what exactly this command does (quite a newbie to python and programming itself) - haven't risked.
If you are using pycharm and have matplotlib.py in your current working directory than you get this error. Just delete or rename the matplotlib.py file and it will work.
don't name any file as matplotlib.py within your working directory
In your working directory, check if there is any file matplotlib.py
Delete that file and import matplotib again. That should work.
simply install:
python -m pip install -U pip
python -m pip install -U matplotlib
I had the same problem reasons in my case were
python 3.8.2 with matplotlib that I downloaded was for 3.7. Make sure they are the same.
python 64 bits version with matplotlib 32bits. Make sure they are the same
Use python -m pip install package_which_you_need to install packages for Windows
Make sure to add to PATH the environment variables I forgot to do in my case
pip version was old use
Use python -m pip install --upgrade pip to upgrade pip to the latest for Windows
I saved the file name as matplotlib.py. Try to avoid that
Finally I typed matplotlib.pyplot as matplotlib.plyplot remember to check for typos first. The error message looks similar even though I corrected all the steps above.
ModuleNotFoundError: No module named 'matplotlib.pyplot'
ModuleNotFoundError: No module named 'matplotlib.plyplot'

Error installing Tweepy for Python (Mac)

I'm working with Python 2.6.6 and have been trying to download tweepy, but whenever I import tweepy in the Python IDLE shell it comes back with a "No module named tweepy" error.
I've downloaded tweepy using
sudo pip install tweepy
And it goes right into /Library/Python/2.7/site-packages with no problems.
Then I cd from that path into tweepy and
python setup.py install
but this error message comes up
/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python: can't open file 'python': [Errno 2] No such file or directory
I've gone through the path and everything is correct with Python at the end.
However, when I open up a Python IDLE shell and
import tweepy
the "No module named tweepy" error comes up.
I'd really appreciate any help!
pip is using Python 2.7, as you can tell from the site-packages path, while you are apparently trying to install for use with 2.6. Leaving aside the question of why you're using 2.6, the problem is easy enough to fix - install pip with Python 2.6.
Download get-pip.py, then (assuming your python command points to version 2.6) run:
sudo python get-pip.py
Once it's installed, you should be able to run
sudo pip2.6 install tweepy
and everything should work properly.