0

How can i install a python package that does not have a setup.py file to call. I want to install a package that it happens to be only a .py.

Do i just save it as a .py and put it somewhere in the directory and then import it?

For example the zipfile package and the ElementTree XML parser

P.S.: I have Python-3.x

3

2 Answers 2

1

Edit: As said in the comments, these packages come with Python 3 so you should not install them manually (and certainly not the 2.7 versions). I let my answer bellow for people wanting to install custom package.

On a python interpreter, if you run:

>>> import sys
>>> sys.path

You will see a list of folder where your python executable search for module. You can put your file either in the site-packages folder or the lib folder.

Sign up to request clarification or add additional context in comments.

4 Comments

Nice Mr Holt i will test now!
Can i please ask if those two packages are suitable for Python 3.x?
The packages may contain lot of compatibilities errors with python 3.0. As Martijn said in comment, these packages come with python 3 so you don't need (and you should not) install them manually.
You have untied my hands you people. Thank you so much!
0

Just put the file somewhere in PYTHONPATH.

3 Comments

On the PYTHONPATH of the Path environmental variable?
Doesn't it have to be on the C:\Python33\Lib\site-packages file ?
A site-packages directory is in Windows PATH, so you can put the file right there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.