Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Wednesday, September 17, 2014

How to install setuptools under a local python

Supposed you have a local python, which is used to built other staff. For example, buildozer will have this


src/.buildozer/android/platform/python-for-android/build/hostpython/Python-2.7.2

And this Python is missing setuptools for compiling, you need to install it under this Python. 

manual download the development version of setuptools from https://pypi.python.org/pypi/setuptools#downloads
move this setuptools into the Python directory
cd into the setuptools direcotry
find the executable for this python

run ../python.exe[where your python executable is] setup.py install

this will install setuptools under the local python. 

Note using easy_install setup tools only installs in your system not the local Python.  

Tuesday, June 24, 2014

How to update twisted Python

Source: http://stackoverflow.com/questions/1117255/how-to-update-the-twisted-framework


Try using virtualenv and pip (sudo easy_install virtualenv pip), which are great ways to avoid the dependency hell that you are experiencing.
With virtualenv you can create isolated Python environments, and then using pip you can directly install new packages into you virtualenvs.
Here is a complete example:

create fresh virtualenv, void of old packages, and install latest Twisted
virtualenv --no-site-packages twisted_env
pip -E twisted_env install -U twisted

#now activate the virtualenv
cd twisted_env
source bin/activate

#test to see you have latest Twisted:
python -c "import twisted; print twisted.__version__"
My Mac does not have -E option for pip. So I just run $ pip install -U twisted

Tuesday, April 8, 2014

sudo keeps PYTHONPATH

http://superuser.com/questions/363813/sudo-does-not-preserve-pythonpath


$visudo

Add Defaults env_keep += PYTHONPATH

Thursday, April 19, 2012

Run Python on Windows

1. Download the python
http://python.org/download/

2. Install it. it ususally installed at C:\Python27

3. Run it need to add the C:\Python27 to the PATH environment variable.
http://docs.python.org/faq/windows.html#how-do-i-run-a-python-program-under-windows
Add

;C:\Python23

to the PAHT environment variable at
properties window of “My Computer” under the “Advanced” tab

4. Type python from the command line