Como instalo o pip, o virtualenv, o python 2.6 e o python 2.7 no Ubuntu 12.04?

0

Eu achei que seria simples, mas acho que estou perdendo algo fácil.

Eu tenho o python 2.7 instalado no Ubuntu 12.04 via apt. Eu peguei o código-fonte do python 2.6 e o compilei. Agora tenho a seguinte estrutura.

ll /usr/bin/python*
lrwxrwxrwx 1 root root       9 Apr 17  2012 /usr/bin/python -> python2.7*
lrwxrwxrwx 1 root root       9 Apr 17  2012 /usr/bin/python2 -> python2.7*
-rwxr-xr-x 1 root root 2799288 Aug  1 00:46 /usr/bin/python2.7*
-rwxr-xr-x 1 root root    1652 Aug  1 00:45 /usr/bin/python2.7-config*



/usr/local/bin$ ll
total 9120
drwxr-xr-x  2 root root    4096 Dec 17 20:35 ./
drwxr-xr-x 10 root root    4096 Oct  7  2010 ../
-rwxrwxr-x  1 root root     111 Dec 17 15:39 2to3*
-rwxr--r--  1 root root     246 Jan 19  2012 fixvpnroute*
-rwxrwxr-x  1 root root      99 Dec 17 15:39 idle*
-rwxrwxr-x  1 root root      84 Dec 17 15:39 pydoc*
-rwxr-xr-x  2 root root 4637487 Dec 17 20:35 python*
-rwxr-xr-x  2 root root 4637487 Dec 17 20:35 python2.6*
-rwxr-xr-x  1 root root    1424 Dec 17 20:35 python2.6-config*
lrwxrwxrwx  1 root root      16 Dec 17 20:35 python-config -> python2.6-config*
-rwxrwxr-x  1 root root   18233 Dec 17 15:39 smtpd.py*
-rwxr-xr-x  1 root root     316 Dec 17 15:54 virtualenv*
-rwxr-xr-x  1 root root     324 Dec 17 15:54 virtualenv

Eu instalei virtualenv usando pip antes instalando o python 2.6. Agora, quando tento usar virtualenv, recebo um erro.

sudo virtualenv -p /usr/local/bin/python2.6 testproject
Running virtualenv with interpreter /usr/local/bin/python2.6
New python executable in testproject/bin/python2.6
Not overwriting existing python script testproject/bin/python (you must use testproject/bin/python2.6)
Installing setuptools.............
  Complete output from command /home/greg/Projects/...roject/bin/python2.6 -c "#!python
\"\"\"Bootstra...sys.argv[1:])






" --always-copy -U setuptools:
  -c:67: DeprecationWarning: the md5 module is deprecated; use hashlib instead
Traceback (most recent call last):
  File "<string>", line 67, in <module>
  File "/usr/local/lib/python2.6/md5.py", line 10, in <module>
    from hashlib import md5
  File "/usr/local/lib/python2.6/hashlib.py", line 138, in <module>
    sha224 = __get_builtin_constructor('sha224')
  File "/usr/local/lib/python2.6/hashlib.py", line 66, in __get_builtin_constructor
    import _sha256
ImportError: No module named _sha256
----------------------------------------
...Installing setuptools...done.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2560, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 964, in main
    never_download=options.never_download)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1074, in create_environment
    search_dirs=search_dirs, never_download=never_download)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 611, in install_setuptools
    search_dirs=search_dirs, never_download=never_download)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 583, in _install_req
    cwd=cwd)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1042, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/greg/Projects/...roject/bin/python2.6 -c "#!python
\"\"\"Bootstra...sys.argv[1:])






" --always-copy -U setuptools failed with error code 1

Então eu tentei instalar setuptools com pip, mas ...

sudo pip install setuptools
Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/lib/python2.7/dist-packages
Cleaning up.

Então, acho que meu problema tem a ver com a execução de pip no contexto do python 2.6, mas não sei como fazer isso. Estou no caminho certo? ..

Editar

Recompilar o Python 2.6 com os módulos sha descomentados foi a solução.

No diretório de origem, editei Módulos / Setup e descomentei estas linhas.

# The _sha module implements the SHA checksum algorithms.
# (NIST's Secure Hash Algorithms.)
_sha shamodule.c
_sha256 sha256module.c
_sha512 sha512module.c

Em seguida, reran configure e faça a instalação.

    
por GregB 18.12.2012 / 04:49

0 respostas

Tags