Reputation: 176
I am trying to install Twitter-Python and I am just not getting it. According to everything I've read this should be easy. I have read all that stuff about easy_install, python setup.py install
, command lines, etc, but I just don't get it. I downloaded the "twitter-1.9.4.tar.gz", so I now have the 'twitter-1.9.4' folder in my root 'C:\Python27' and tried running
>>> python setup.py install
in IDLE... and that's not working. I was able to install a module for yahoo finance and all I had to do was put the code in my 'C:\Python27\Lib' folder.
How are these different and is there a REALLY BASIC step-by-step for installing packages?
Upvotes: 6
Views: 14143
Reputation: 286
1) Run CMD as administrator
2) Type this:
set path=%path%;C:\Python27\
3) Download python-twitter, if you haven't already did, this is the link I recommend:
https://code.google.com/p/python-twitter/
4) Download PeaZip in order to extract it:
http://peazip.org/
5) Install PeaZip, go to where you have downloaded python-twitter, right click, extract it with PeaZip.
6) Copy the link to the python-twitter folder after extraction, which should be something like this:
C:\Users\KiDo\Downloads\python-twitter-1.1.tar\dist\python-twitter-1.1
7) Go back to CMD, and type:
cd python-twitter location, or something like this:
cd C:\Users\KiDo\Downloads\python-twitter-1.1.tar\dist\python-twitter-1.1
8) Now type this in CMD:
python setup.py install
And it should work fine, to confirm it open IDLE, and type:
import twitter
Now you MAY get another error, like this:
>>> import twitter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\twitter.py", line 37, in <module>
import requests
ImportError: No module named requests
Then you have to do kinda same steps in order to download the module requests.
Upvotes: 3
Reputation: 1
Today, after using pre method, I could not use it again (as per my post yesterday). So I tried another way that's simple and cool and hope would work always (on my pc at least):
...Python34>cd scripts #command prompt change die where pip is
...Python34\Scripts>pip install fabric #in this dir, use pip
Awesome (for me at least) although the package I wanted could not be 'perfectly' installed, yet another pythovery.
Upvotes: 0
Reputation: 1
Basically, with python3.4.3, you just have to do two things to be able to use twitter: 1.python -m pip install -U pip then once pip is updated (as it comes preinstalled). you do the second step: 2. pip install twitter this will install twitter package.
Upvotes: 0
Reputation: 11
You need to set the Windows system path variables to include c:\Python27 and C:\Python27\Scripts. You do not need to set PYTHONPATH nor use any bat files.
Path c:\Python27 will tell Windows where python.exe is
Path c:\Python27\Scripts will tell Windows where pip is
Run pip from Windows command line (do not use Idle)
Upvotes: 0
Reputation: 5082
Installing Python Modules clearly states you need to install the packages from command line, not the Python interpreter IDE (like IDLE):
For Windows, this command should be run from a command prompt window (Start ‣ Accessories):
setup.py install
You mention the python setup.py install
command, which intends calling python interpreter already and wouldn't make sense to run within interpreter.
Upvotes: 0
Reputation: 314
Looking at the directory structure you have, I am assuming that you are using Windows. So my recommendation is to use a package manager system such as pip. pip allows you to install python packages very easily.
You can install pip here: pip for python
Or if you want the windows specific version, there are some pre built windows binaries here: pip for windows
Doing python setup.py install in IDLE will not work because that is an interactive python interpreter. You would want to call python from the command line to install.
with pip, you can go to the command line and run something like this:
"pip install twitter-python"
Not all python packages are found with pip but you can search using
"pip search twitter-python"
The nature of pip is that you have to type out the exact name of the module that you want.
So in a nutshell, my personal recommendation to get python packages installed is:
This should install everything without a hitch.
Upvotes: 2