4

i am new to python and i am installing python pakages but i get this error

Error:
    Traceback (most recent call last):
      File "setup.py", line 3 in <module>
        from setuptools import setup, find_packages
    ImportError: No module named setuptools

but when iam installing setuptools and run it i get this error

Traceback (most recent call last):
  File "C:/Python32/yyy.py", line 7, in <module>
    execfile(convert_path('setuptools/command/__init__.py'), d)
NameError: name 'execfile' is not defined

i am windows 7 user . if any 1 have experience about it please figure it out and whats this mean Unpack the archive, enter the pyserial-x.y directory and run ? mean i have to install it from command prompt

i want to use twitter api in python . when i run its setup file it show error . i open it with notepad and copy the setup code and paste it in script and save it with yyy.py and run it and now it give me the error like this

File "C:\Python26\twittersetup.py",
line 13, in <module> 
long_description=open("./README", "r").read(), 
IOError: [Errno 2] No such file or directory: './README'

this errorr in python 3.2

File "C:/Python32/t.py",
line 9, in <module> 
setup(name='twitter',
NameError: name 'setup' is not defined

AND NOW AFTER MANY SURVIVALS I GOT THIS ERROR

Traceback (most recent call last):
File "C:\Users\Sheikh\Desktop\twitter-1.9.0 (1).tar\twitter-1.9.0\setup.py",
line 47, 
in <module>""",File "C:\Python32\lib\distutils\core.py",
line 136, in setup
raise SystemExit(gen_usage(dist.script_name) + "\nerror: %s" % msg)
SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
  • What are you actually trying to do? Can you include the code from the `yyy.py` file above? You have an error installing a package and then another error trying to install setuptools to allow you to install the package? – stderr Aug 05 '12 at 12:56
  • this errorr in python 3.2 (((File "C:/Python32/t.py", line 9, in setup(name='twitter', NameError: name 'setup' is not defined))))) –  Aug 05 '12 at 13:04
  • you can edit your question to add this information. – stderr Aug 05 '12 at 13:13
  • Why are you copying and pasting the `setup.py` into a separate file? You can't run the setup script from anywhere but the `python-twitter` source directory. – stderr Aug 05 '12 at 13:24
  • i hope this is now readable for you . and i wish it also understandable for you :) –  Aug 05 '12 at 13:25
  • if i run it from there it also give the error . black screen flash for sometime and thn gone and nothing happen –  Aug 05 '12 at 13:26

3 Answers3

2

execfile() will only work in Python 2, use exec() in Python 3

From http://pypi.python.org/pypi/setuptools/ it is clear that setuptools is only available for python 2.3, 2.4, 2.5, 2.6 and 2.7, so better install it on one of them not on 3.x.

Read Alternative to execfile in Python 3.2+?


Edit: Setuptools now support Python 3.3+.

Ashwini Chaudhary
  • 244,495
  • 58
  • 464
  • 504
2

setuptools doesn't appear to support python 3 (at least according to the Python Package Index).

Try distribute which provides the setuptools api and provides python3 compatibility: http://pypi.python.org/pypi/distribute

It looks like python-twitter does not support python3 so you'll have to use Python 2.6.

The 2.6 error message is pretty clear:

"C:\Python26\twittersetup.py", line 13, in <module> long_description=open("./README", "r").read(), IOError: [Errno 2] No such file or directory: './README') 

Basically you're attempting to run the script from another directory than the directory that contains the README file.

I'd start over and make sure you start by downloading and unpacking the complete source for python-twitter: http://pypi.python.org/packages/source/p/python-twitter/python-twitter-0.8.2.tar.gz

Next, uncompress and unpack the source (7-Zip works nicely for this).

Then open up cmd and cd to that unpacked directory (which should include the README file and the setup.py file). Then run something like:

C:\Python2.6\python2.6.exe setup.py
stderr
  • 8,567
  • 1
  • 34
  • 50
  • i dnt have any experience of cmd :( :( –  Aug 05 '12 at 13:30
  • Learning to use the CLI is very helpful for Python and there are quite a few resources out there to learn. There are also guides for properly setting up Python on windows so that it works reasonably from the commandline. (http://cli.learncodethehardway.org/book/cli-crash-coursech1.html, http://www.stat.ucla.edu/~rosario/classes/07F/202a/python/index.html, http://www.instructables.com/id/How-to-install-Python-packages-on-Windows-7/ ). – stderr Aug 05 '12 at 13:45
  • now i have some different error i do all the things !! oaah my GOd –  Aug 05 '12 at 19:36
1

First you need to install setuptools from pypi and then you need to run setup.py file through commands using cmd. Using setup.py --help-commands in Windows tell you the step and commands.