site.py deleted

0 votes
I have deleted the Python installation file, i.e, the site.py file by mistake. Now after starting Python, it shows the following error:

ImportError: Couldn't find the real 'site' module

I tried downloading a site.py from setuptools but this results in an infinite recursion in the __boot method around the statement imp.load_module('site',stream,path,descr)

Can anyone help me with reinstalling Python and also tell me what is the work of site.py file?
Nov 29, 2018 in Python by ana1504.k
• 7,430 points
50 views

1 answer to this question.

0 votes
You can download a new copy from the python source repository:

For python 2.7
For python 3.2
 

For other python versions, generally the URL is http://hg.python.org/cpython/file/*major*.*minor*/Lib/site.py for the correct tagged version, then select the raw link in the left-hand menu.

If you installed python from a linux distribution package on Ubuntu or Debian, then this file has been customized and you'll need to re-install the appropriate python-minimal package.
answered Nov 29, 2018 by SDeb
• 12,280 points

Related Questions In Python

0 votes
1 answer

init.py file

It is used to denote directories on ...READ MORE

answered Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
26 views
0 votes
1 answer

How do I know what's going to be deleted?

An easy system would be to add ...READ MORE

answered Aug 27, 2018 in Python by anonymous
24 views
0 votes
1 answer

Install .desktop file with setup.py

This looks like a good approach but ...READ MORE

answered Jun 27 in Python by SDeb
• 12,280 points
17 views
0 votes
1 answer

Python application from .py to .exe

You can use pyinstaller for this purpose. PyInstaller bundles ...READ MORE

answered Jul 4 in Python by Pooja
13 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 128 views
0 votes
11 answers
0 votes
1 answer

py.test logging for tests that pass

you could use py-cov combine with pytest py.test ...READ MORE

answered Apr 2 in Python by SDeb
• 12,280 points
75 views