Trying to get a simple Python installation working on my Mac?

I have Mac OSX 10.5.8 installed with Xcode installed. I want to avoid MacPorts and just want to get a solid foundation for installing Python so that I can continue to work with Django and other things. I want to use Buildout with my Python applications.

I installed binary Python 2.6.4 from the official site and installed it. Following other tips, I put this in my ~/.bash_profile file:

 export PATH=/usr/local/bin:$PATH 

So, when I do a which python , it shows /usr/local/bin/python . And when I do python -V , it shows Python 2.6.4 - it all seems great.

I looked at the /usr/local/bin/ and, among other things, I seem to have the right things pointing to Python 2.6:

 python -> ../../../Library/Frameworks/Python.framework/Versions/2.6/bin/python 

BUT, when I do easy_install virtualenv (which I want to use with Buildout), it seems to install it in /Library/Python/2.5/site-packages/virtualenv-1.4.3-py2.5.egg

... what is Python 2.5? Also, when I configure my Buildout folder using virtualenv, there is a .Python :

 .Python -> /System/Library/Frameworks/Python.framework/Versions/2.5/Python 

Why is this? I do not understand this. How can I get all this to point to the correct Python 2.6?

Thanks so much for any answers, this annoys me. Greetings.

+3
source share
5 answers

Firstly, there is absolutely no need to install a new version of Python to work with Django in Leopard. Stock Python 2.5 is working absolutely fine, and Django is 100% compatible with this version.

Secondly, if you want to use virtualenv with a different version of Python than the default system version, you just need to say this when creating virtualenv:

 virtualenv --python=/path/to/python/2.6 virtualenvname 
+2
source

When you install a new instance of Python, you also need to install a new copy of easy_install for it. Follow the instructions for the classic setuptools or the new Distribute . In any case, for python.org 2.6.4 on OS X, an easy_install script will be installed in /Library/Frameworks/Python.framework/Versions/2.6/bin , which should appear before /usr/bin on your $PATH shell.

+1
source

Personally, what I'm doing is to leave my system python completely as it is.

I use the following to install Python versions 2.4, 2.5, and 2.6:

Use buildout from plone collections to get python2. {4,5,6} installed with easy_install and PIL (including libjpeg support)

Checkout python assembly files from plone collections. I like putting it in / home / dev / python -buildout

 # svn co http://svn.plone.org/svn/collective/buildout/python /home/dev/python-buildout 

Add a new local.cfg file to the src directory. Here you indicate what you want to build. In the assembly file, do the following:

 [buildout] extends = base.cfg readline.cfg libjpeg.cfg python24.cfg python25.cfg python26.cfg links.cfg parts = ${buildout:base-parts} ${buildout:readline-parts} ${buildout:libjpeg-parts} ${buildout:python24-parts} ${buildout:python25-parts} ${buildout:python26-parts} ${buildout:links-parts} 

Download your system python and then run buildout.

 # python bootstrap.py # ./bin/buildout -c src/local.cfg 

When everything has been compiled, you should have new python binaries:

 /home/dev/python-buildout/src/python-2.{4,5,6}/bin/python 

To use them, either add the bin directory to your path, or specify an β€œactivate” script in the bin directory, which will set it as active python in your current shell

 daniel@madmax # which python /usr/bin/python daniel@madmax # python -V Python 2.6.1 daniel@madmax # source /home/dev/python-buildout/src/python-2.4/bin/activate (python-2.4) daniel@madmax # which python /home/dev/python-buildout/src/python-2.4/bin/python (python-2.4) daniel@madmax # python -V Python 2.4.6 daniel@madmax # source /home/dev/python-buildout/src/python-2.6/bin/activate (python-2.6) daniel@madmax # which python /home/dev/python-buildout/src/python-2.6/bin/python (python-2.6) daniel@madmax # python -V Python 2.6.4 

For each project I'm working on, I try to create a new virtual environment using non-package sites and the corresponding version of Python.

0
source

PirosBOX: ~ piros $ python -V Python 2.5.1

Does OSX have 10.5.8 and I write excellent django applications: D It is important to get the version of SVN Django, better!

0
source

Source: https://habr.com/ru/post/1340635/


All Articles