Installiert ist ein Python 2.7.9
Mit
aptitude install python3
wird die aktuelle Version installiert.
Anschließend muss nur noch der Symlink zu python 2.7 entfernt und auf 3.4 gesetzt werden.
ls -la /usr/bin/ |grep python -rwxr-xr-x 1 root root 1056 Mar 28 2015 dh_python2 lrwxrwxrwx 1 root root 23 Mar 8 2015 pdb2.7 -> ../lib/python2.7/pdb.py lrwxrwxrwx 1 root root 23 Oct 19 2014 pdb3.4 -> ../lib/python3.4/pdb.py lrwxrwxrwx 1 root root 9 Mar 28 2015 python -> python2.7 lrwxrwxrwx 1 root root 9 Mar 28 2015 python2 -> python2.7 -rwxr-xr-x 1 root root 3201580 Mar 8 2015 python2.7 -rwxr-xr-x 2 root root 3816928 Oct 19 2014 python3.4 -rwxr-xr-x 2 root root 3816928 Oct 19 2014 python3.4m lrwxrwxrwx 1 root root 29 Mar 28 2015 pyversions -> ../share/python/pyversions.py unlink /usr/bin/python unlink /usr/bin/python cd /usr/bin/ ln -s /usr/bin/python3.4 python python -V Python 3.4.2
Et voila. Python 3 in der aktuellsten Version steht zur Verfügung und wird standardmäßig verwendet.
Alternativ kann man virtualenv verwenden.
Um nun Python Module zu installieren kann man pip installieren:
aptitude install python3-pip
pip ist eine Paketverwaltung für Python und ersetzt easy_install.
Um nun SQLAlchemy zu installieren wird unter Linux empfohlen, ein virtualenv zu installieren.
http://pythoncentral.io/how-to-install-sqlalchemy/ sudo pip3 install virtualenv
Dann als normaler Benutzer in ein beliebiges Verzeichnis wechseln. Mit dem folgenden Befehl wird dann dort ein Verzeichnis ‘cal’ mit der virtualenv erstellt.
user@raspberrypi:~ $ virtualenv cal Using base prefix '/usr' New python executable in /home/wiego/cal/bin/python Installing setuptools, pip, wheel...done. # Wechseln in die virutalenv mit cd cal #aktivieren source /bin/activate (cal) user@raspberrypi:~/cal $
Die runden Klammern zeigen, dass man sich nun in der virtuellen Umgebung befindet.
(cal) user@raspberrypi:~/cal $ pip install sqlalchemy
Installiert nun Module nur in der virtuellen Umgebung.
Schreib als Erster einen Kommentar