what are site directories in python ? are these some special folders ?
Something like C:\Python33\Lib\site-packages is a directory Python will automatically look into.
oh! is it where i have to copy paste my downloaded python packages for them to work?
i have to copy paste my downloaded python packages for them to work?
You do not copy/paste into site-packages folder yourself,you can but that's not the correct way(and it may not work).
First the manual way.
You download a packages extract to where-ever you want.
From command line cmd naviagte to extract folder then write
python setup.py install
Under this install will files go to site-packages folder and package is installed.
There are two tool for eaiser install easy_install and pip(recommended)
pip also have an uninstall function for packages.
Both of these tool will download a package from web and install it.
So as an example from cmd you write
pip install numpy then download and install happens automatically.
Rembere to check environment variables Path
In Path if not there add
Or for python 3
Restart to make it work.
This can be needed to be correct for all method i postet over to work fine.
in past i have downloaded some packages to a different directory instead of C:\Python26\Lib\site-packages
is their a quick way to add that path (e:\pythonpacks) to site directory without having to copy them to C:\Python26\Lib\site-packages
Add e:\pythonpacks to the PYTHONPATH environment variable (or create the variable).
well but then isnt it almost equal to doing copy paste becuase i downloaded to this folder and extracted, this is really getting confusing to me.. now..
i downloaded to this folder and extracted
You don't have to download the packages in the folder where they will be installed. As Snippsat said above, suppose you download a package foo.zip, then uncompress it, producing a folder foo with a setup.py file. You must open windows cmd console. In the console, type
cd C:\path\to\folder\foo and enter, then type
python setup.py install, enter. The package installs itself automatically in site-packages.
this helps however some of my packages dont contain a setup.py just
with other py files, i guess i would have to manually copy these ones..?
Do you have many of those modules ? You can try to move the folder with the
__init__.py to site-packages and see if the module works.
yes i did, gr8 , however I aded the path (e:/pythonpacks) to sys.path.
We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.