# [Risolto] Passaggio da Python 3.2.3 a Python 2.7.3-r2

## Javaskit

Salve a tutti, facendo qualche ricerca nel forum ho letto https://forums.gentoo.org/viewtopic-t-805584.html dove si parla appunto di Python 3. Il discorso mi ha incuriosito e continuando la ricerca ho trovato quest'altro topic https://forums.gentoo.org/viewtopic-t-921776-start-0.html . In entrambi i topic viene suggerito di non usare come Python predefinito Python 3 ed è quello che credevo di fare anche io fino a quando lanciando eselect python list ho ottenuto: 

eselect python list

```
Available Python interpreters:

  [1]   python2.7

  [2]   python3.2 *
```

La cosa strana è che non mi pare di aver esplicitamente mai settato quest'ultima versione   :Shocked:   .

Comunque volevo chiedervi se mi conviene mantenere entrambe le versioni ed usare però python2.7 come predefinito. Inoltre per fare questo, devo semplicemente lanciare questi comandi ?

```
 eselect python set python2.7

python-updater

emerge --depclean

revdep-rebuild
```

EDIT: ho la sgradevole impressione di aver fornito poche informazioni   :Very Happy:   quindi vi riporto almeno il risultato di

emerge --info

```
Portage 2.1.10.65 (default/linux/x86/10.0/desktop/kde, gcc-4.5.3, glibc-2.14.1-r3, 3.2.21-gentoo i686)

=================================================================

System uname: Linux-3.2.21-gentoo-i686-Intel-R-_Core-TM-2_Duo_CPU_T8100_@_2.10GHz-with-gentoo-2.1

Timestamp of tree: Sat, 04 Aug 2012 00:45:01 +0000

app-shells/bash:          4.2_p20

dev-java/java-config:     2.1.11-r3

dev-lang/python:          2.7.3-r2, 3.2.3

dev-util/cmake:           2.8.7-r5

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.1-r1

sys-apps/openrc:          0.9.8.4

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.13, 2.68

sys-devel/automake:       1.11.1

sys-devel/binutils:       2.21.1-r1

sys-devel/gcc:            4.5.3-r2

sys-devel/gcc-config:     1.6

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r1

sys-kernel/linux-headers: 3.1 (virtual/os-headers)

sys-libs/glibc:           2.14.1-r3

Repositories: gentoo sage-on-gentoo

ACCEPT_KEYWORDS="x86"

ACCEPT_LICENSE="* -@EULA"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=native -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-O2 -march=native -pipe"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-O2 -march=i686 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch webrsync-gpg"

FFLAGS="-O2 -march=i686 -pipe"

GENTOO_MIRRORS="http://distfiles.gentoo.org"

LANG="it_IT.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="it en"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/var/lib/layman/sage-on-gentoo"

SYNC=""

USE="X a52 aac acl acpi alsa berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cxx dbus declarative dri dts dvd dvdr emboss encode exif fam ffmpeg firefox flac fortran gdbm gif gpm hddtemp iconv ipv6 java jpeg kde kipi lcms ldap libnotify lm_sensors mad mmx mng modules mp3 mp4 mpeg mudflap ncurses nls nptl nsplugin ogg opengl openmp pam pango pcre pdf phonon plasma png policykit ppds pppd qt3support qt4 readline sdl semantic-desktop session spell sse sse2 ssl startup-notification svg tcpd theora tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 x86 xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="it en" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
```

Last edited by Javaskit on Thu Sep 27, 2012 8:29 am; edited 1 time in total

----------

## ago

vanno bene i comandi postati, se vuoi eliminare del tutto python3, usa USE_PYTHON e PYTHON_TARGETS

----------

## Javaskit

ago,

grazie della risposta con un tempismo invidiabile   :Very Happy:  . Effettivamente se non fosse necessario Python 3 lo rimuoverei ma prima vorrei essere sicuro che non sia necessario per nessun pacchetto che ho installato. C'è un modo per vedere se dei pacchetti necessitano di questa versione ? Eseguendo 

equery d python-3.2.3 ottengo :

```
 * These packages depend on python-3.2.3:

app-admin/python-updater-0.10 (dev-lang/python)

app-portage/gentoolkit-0.3.0.6-r3 (dev-lang/python[xml])

                                  (dev-lang/python)

                                  (>=dev-lang/python-2.6[xml])

app-portage/layman-1.4.2-r3 (dev-lang/python)

                            (=dev-lang/python-2.7*)

                            (=dev-lang/python-2.6*)

                            (=dev-lang/python-2.5*)

                            (=dev-lang/python-2.7*[xml])

                            (=dev-lang/python-2.6*[xml])

                            (=dev-lang/python-2.5*[xml])

dev-java/ant-contrib-1.0_beta2-r2 (>=dev-lang/python-2.4)

dev-java/ant-core-1.8.4-r1 (>=dev-lang/python-2.4)

dev-java/ant-nodeps-1.8.4 (>=dev-lang/python-2.4)

dev-java/bcel-5.2-r2 (>=dev-lang/python-2.4)

dev-java/bcmail-1.45 (>=dev-lang/python-2.4)

dev-java/bcprov-1.45 (>=dev-lang/python-2.4)

dev-java/bsh-2.0_beta4-r3 (>=dev-lang/python-2.4)

dev-java/commons-cli-1.2 (>=dev-lang/python-2.4)

dev-java/commons-logging-1.1.1 (>=dev-lang/python-2.4)

dev-java/itext-2.1.5 (>=dev-lang/python-2.4)

dev-java/java-config-2.1.11-r3 (=dev-lang/python-3.2*)

                               (=dev-lang/python-3.1*)

                               (=dev-lang/python-2.7*)

                               (=dev-lang/python-2.6*)

dev-java/javacc-4.2 (>=dev-lang/python-2.4)

dev-java/javatoolkit-0.3.0-r6 (=dev-lang/python-2.7*)

                              (=dev-lang/python-2.6*)

                              (=dev-lang/python-2.5*)

                              (=dev-lang/python-2.7*[xml])

                              (=dev-lang/python-2.6*[xml])

                              (=dev-lang/python-2.5*[xml])

dev-java/jdbc-mysql-5.1.14 (>=dev-lang/python-2.4)

dev-java/junit-3.8.2-r1 (>=dev-lang/python-2.4)

dev-java/lucene-2.9.4 (>=dev-lang/python-2.4)

dev-java/lucene-analyzers-2.3.2 (>=dev-lang/python-2.4)

dev-java/servletapi-2.4-r5 (>=dev-lang/python-2.4)

dev-java/sun-jaf-1.1.1 (>=dev-lang/python-2.4)

dev-java/sun-javamail-1.4.3 (>=dev-lang/python-2.4)

dev-java/xerces-2.11.0 (>=dev-lang/python-2.4)

dev-java/xjavac-20110814 (>=dev-lang/python-2.4)

dev-java/xml-commons-external-1.4.01 (>=dev-lang/python-2.4)

dev-java/xml-commons-resolver-1.2 (>=dev-lang/python-2.4)

dev-lang/yasm-1.2.0 (python ? =dev-lang/python-2.7*)

dev-libs/boost-1.48.0-r2 (python ? dev-lang/python)

dev-libs/glib-2.30.3 (test ? =dev-lang/python-2*)

                     (utils ? =dev-lang/python-2*)

dev-libs/gobject-introspection-1.30.0-r2 (=dev-lang/python-2.7*)

                                         (=dev-lang/python-2.6*)

                                         (=dev-lang/python-2.5*)

                                         (=dev-lang/python-2.7*[xml])

                                         (=dev-lang/python-2.6*[xml])

                                         (=dev-lang/python-2.5*[xml])

dev-libs/libgamin-0.1.10-r2 (python ? =dev-lang/python-2*)

dev-libs/libxml2-2.8.0_rc1 (python ? =dev-lang/python-2*)

                           (python ? =dev-lang/python-2*[xml])

dev-libs/libxslt-1.1.26-r3 (python ? =dev-lang/python-2*)

dev-python/PyQt4-4.9.1 (dev-lang/python)

dev-python/argparse-1.2.1 (dev-lang/python)

dev-python/cvxopt-1.1.5-r1 (dev-lang/python)

dev-python/cython-0.15.1-r1 (dev-lang/python)

dev-python/dbus-python-1.0.0 (=dev-lang/python-3*)

                             (=dev-lang/python-2.7*)

                             (=dev-lang/python-2.6*)

dev-python/docutils-0.8.1 (dev-lang/python)

dev-python/gdmodule-0.56-r2 (=dev-lang/python-2*)

dev-python/imaging-1.1.7-r1 (=dev-lang/python-2*)

                            (tk ? =dev-lang/python-2*[tk])

dev-python/ipython-0.10.2 (=dev-lang/python-2*)

dev-python/jinja-2.6 (dev-lang/python)

dev-python/markupsafe-0.15 (dev-lang/python)

dev-python/matplotlib-1.1.0 (=dev-lang/python-2*)

                            (tk ? =dev-lang/python-2*[tk])

dev-python/mpmath-0.17 (dev-lang/python)

dev-python/networkx-1.2 (dev-lang/python)

dev-python/numpy-1.5.1 (dev-lang/python)

dev-python/pexpect-2.0-r1 (=dev-lang/python-2.7*)

                          (=dev-lang/python-2.6*)

dev-python/pycairo-1.10.0-r2 (=dev-lang/python-3.2*)

                             (=dev-lang/python-3.1*)

                             (=dev-lang/python-2.7*)

                             (=dev-lang/python-2.6*)

                             (dev-lang/python)

dev-python/pycrypto-2.6 (=dev-lang/python-2*)

dev-python/pycxx-6.2.4-r1 (dev-lang/python)

dev-python/pygments-1.5 (dev-lang/python)

dev-python/pyopengl-3.0.1 (tk ? dev-lang/python[tk])

                          (dev-lang/python)

dev-python/pyopenssl-0.12 (doc ? =dev-lang/python-2*)

                          (dev-lang/python)

dev-python/pyparsing-1.5.6 (dev-lang/python)

dev-python/pysqlite-2.6.3 (=dev-lang/python-2*)

dev-python/python-dateutil-2.1 (dev-lang/python)

dev-python/pytz-2012c (dev-lang/python)

dev-python/rpy-2.2.6 (dev-lang/python)

dev-python/setuptools-0.6.21 (dev-lang/python)

dev-python/sip-4.13.2-r1 (dev-lang/python)

dev-python/six-1.1.0 (dev-lang/python)

dev-python/sphinx-1.1.3-r3 (=dev-lang/python-2*)

dev-python/sqlalchemy-0.7.6 (sqlite ? >=dev-lang/python-2.5[sqlite])

                            (test ? >=dev-lang/python-2.5[sqlite])

                            (dev-lang/python)

dev-python/sympy-0.7.1 (=dev-lang/python-2.7*)

                       (=dev-lang/python-2.6*)

                       (=dev-lang/python-2.5*)

dev-python/twisted-11.0.0 (=dev-lang/python-2*)

dev-python/twisted-mail-11.0.0 (=dev-lang/python-2*)

dev-python/twisted-names-11.0.0 (=dev-lang/python-2*)

dev-python/twisted-web2-8.1.0 (dev-lang/python)

dev-python/wxpython-2.8.12.1 (=dev-lang/python-2*)

dev-util/boost-build-1.48.0-r1 (python ? dev-lang/python)

dev-util/scons-2.1.0 (=dev-lang/python-2.7*)

                     (=dev-lang/python-2.6*)

                     (=dev-lang/python-2.5*)

                     (=dev-lang/python-2.7*[threads])

                     (=dev-lang/python-2.6*[threads])

                     (=dev-lang/python-2.5*[threads])

dev-vcs/git-1.7.8.6 (python ? =dev-lang/python-2*)

gnome-base/libglade-2.6.4 (=dev-lang/python-2*)

gnome-base/librsvg-2.34.2 (=dev-lang/python-2*)

kde-base/marble-4.8.3 (python ? =dev-lang/python-2*)

kde-base/plasma-workspace-4.8.3 (python ? =dev-lang/python-2*)

kde-base/superkaramba-4.8.3 (python ? =dev-lang/python-2*)

media-gfx/exiv2-0.21.1-r1 (=dev-lang/python-2*)

media-gfx/graphite2-1.1.3 (test ? =dev-lang/python-2*)

media-libs/alsa-lib-1.0.25-r1 (python ? =dev-lang/python-2*)

media-libs/lcms-1.19 (python ? =dev-lang/python-2*)

media-libs/mesa-8.0.3 (=dev-lang/python-2*)

net-libs/libproxy-0.4.7 (python ? =dev-lang/python-2.7*)

                        (python ? =dev-lang/python-2.6*)

net-libs/rb_libtorrent-0.15.10 (python ? =dev-lang/python-2.7*)

                               (python ? =dev-lang/python-2.6*)

                               (python ? =dev-lang/python-2.7*[threads])

                               (python ? =dev-lang/python-2.6*[threads])

net-p2p/qbittorrent-2.9.7 (=dev-lang/python-2*)

net-zope/transaction-1.1.1 (=dev-lang/python-2*)

net-zope/zc-lockfile-1.0.0 (dev-lang/python)

net-zope/zconfig-2.9.0 (=dev-lang/python-2*)

net-zope/zdaemon-2.0.4 (dev-lang/python)

net-zope/zodb-3.9.7 (=dev-lang/python-2*)

net-zope/zope-event-3.5.0.1 (dev-lang/python)

net-zope/zope-fixers-1.0 (=dev-lang/python-3.2*)

                         (=dev-lang/python-3.1*)

                         (=dev-lang/python-2.7*)

                         (=dev-lang/python-2.6*)

net-zope/zope-interface-3.8.0 (dev-lang/python)

net-zope/zope-proxy-3.6.1 (=dev-lang/python-2*)

sci-chemistry/jmol-12.0.45 (>=dev-lang/python-2.4)

sci-chemistry/jmol-applet-12.0.45-r1 (>=dev-lang/python-2.4)

sci-libs/jmol-acme-1.0 (>=dev-lang/python-2.4)

sci-libs/pynac-0.2.3 (=dev-lang/python-2.7*)

sci-libs/scipy-0.10.1 (dev-lang/python)

sci-libs/zn_poly-0.9-r3 (=dev-lang/python-2*)

sci-mathematics/polybori-0.8.1-r0 (=dev-lang/python-2.7*)

sci-mathematics/sage-5.0-r1 (=dev-lang/python-2.7*)

                            (=dev-lang/python-2.7*[readline,sqlite])

sci-mathematics/sage-clib-5.0 (=dev-lang/python-2.7*)

sci-mathematics/sage-data-elliptic_curves-0.6 (=dev-lang/python-2.7*)

                                              (=dev-lang/python-2.7*[sqlite])

sci-mathematics/sage-notebook-0.8.29-r1 (=dev-lang/python-2.7*)

sys-apps/dbus-1.4.20 (test ? dev-lang/python:2.7)

sys-apps/file-5.09 (python ? dev-lang/python)

sys-apps/portage-2.1.10.65 (python3 ? =dev-lang/python-3*)

                           (!python3 ? >=dev-lang/python-2.7)

                           (!python3 ? dev-lang/python:2.6[threads])

                           (!python3 ? dev-lang/python:2.7)

                           (python3 ? =dev-lang/python-3*[ssl])

                           (!python3 ? >=dev-lang/python-2.7[ssl])

                           (!python3 ? dev-lang/python:2.6[threads,ssl])

                           (!python3 ? dev-lang/python:2.7[ssl])

                           (!python3 ? dev-lang/python:2.6[ssl,threads])

                           (kernel_linux ? >=dev-lang/python-3.3_pre20110902)

sys-apps/usbutils-004 (python ? =dev-lang/python-2.7*)

                      (python ? =dev-lang/python-2.6*)

sys-libs/cracklib-2.8.16 (python ? =dev-lang/python-2*)

x11-libs/libxcb-1.8.1 (dev-lang/python[xml])

x11-proto/xcb-proto-1.7.1 (dev-lang/python)
```

Un'altra informazione, quindi dopo aver dato i comandi che ho postato per rimuovere la versione 3 non sarebbe sufficiente emerge --unmerge python-3.2.3 ? Infine USE_PYTHON e PYTHON_TARGETS devono essere impostate nel make.conf giusto ? Ti dispiacerebbe spiegarmi il loro significato perchè ho fatto una ricerca con man make.conf ma non ho trovato nulla a riguardo. Grazie.

----------

## Javaskit

Dopo un paio di mesi trascorsi stando alla larga da questo "problemino" perchè avevo la necessità di avere una Gentoo box funzionante, ieri ho ripreso questo topic. Come suggerito da ago e approfondendo ulteriormente seguendo questa guida http://en.gentoo-wiki.com/wiki/Python_maintenance , ho aggiunto le seguenti righe in 

 /etc/make.conf : 

USE_PYTHON="2.7"

PYTHON_TARGETS="python2_7"

Dopo ho lanciato i seguenti comandi :

```

eselect python set python2.7

python-updater

emerge --depclean

revdep-rebuild

```

Arrivati a questo punto dovrei utilizzare python 2.7. Grazie a tutti per l'aiuto.

----------

