Установка модулей для Python.3

Я пытаюсь установить модуль biopython на мой компьютер с Ubuntu 12.04 LTS (64x). Сначала я обновился до Python3.3 путем установки из исходного кода (biopython не поддерживает другие версии), что кажется нормальным.

Однако я установил некоторые модули с помощью команды sudo apt-get install python-module, но я не могу вызвать их из оболочки Python:

dovah@AsusX501A:~$ python3.3
Python 3.3.5 (default, Mar 12 2014, 02:09:17)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from biopython import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'biopython'
>>> from Bio import * ##as suggested in http://biopython.org/DIST/docs/api/module-tree.html
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'Bio'

Как видите, модули установлены:

dovah@AsusX501A:~$ sudo apt-get install python-biopython
Reading package lists... Done
Building dependency tree      
Reading state information... Done
python-biopython is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Как и в случае с биопифоном (довольно странно: в строке 14 написано biopython-1.64-py2.7-linux-x86_64.egg, так что лучший результат был найден для версии 2.7, а не 3.3):

dovah@AsusX501A:~$ sudo easy_install -f http://biopython.org/DIST/ biopython
Searching for biopython
Reading http://biopython.org/DIST/
Best match: biopython 1.64
Downloading http://biopython.org/DIST/biopython-1.64.zip
Processing biopython-1.64.zip
Writing /tmp/easy_install-v5LJZz/biopython-1.64/setup.cfg
Running biopython-1.64/setup.py -q bdist_egg --dist-dir /tmp/easy_install-v5LJZz/biopython-1.64/egg-dist-tmp-TruGJH
warning: no previously-included files matching '.cvsignore' found under directory '*'
warning: no previously-included files matching '*.pyc' found under directory '*'
zip_safe flag not set; analyzing archive contents...
Bio.Entrez.Parser: module references __path__
Adding biopython 1.64 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/biopython-1.64-py2.7-linux-x86_64.egg
Processing dependencies for biopython
Finished processing dependencies for biopython

Являются ли модули специфичными для данной версии Python ? Система все еще зависает на Python 2.7? Очевидно, я не могу просто удалить 2.7, если я не хочу испортить всю мою ОС.

Заранее благодарю за помощь.

РЕДАКТИРОВАТЬ numpy успешно установлен с помощью: sudo apt-get install python3-numpy

1
задан 22 July 2014 в 17:32

2 ответа

Работы отлично, проверьте его. Первая команда:

sudo apt-get install python3-pip

Вторая команда:

pip3 install biopython
root@saurabh-ubuntu:/home/saurabh# apt-get install python-pip python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libexpat1-dev libpython3-dev libpython3.4-dev python-colorama python-distlib
  python-html5lib python-requests python-setuptools python-urllib3
  python3-colorama python3-dev python3-distlib python3-html5lib
  python3-setuptools python3.4-dev
Suggested packages:
  python-genshi
Recommended packages:
  python-dev-all
The following NEW packages will be installed:
  libexpat1-dev libpython3-dev libpython3.4-dev python-colorama python-distlib
  python-html5lib python-pip python-requests python-setuptools python-urllib3
  python3-colorama python3-dev python3-distlib python3-html5lib python3-pip
  python3-setuptools python3.4-dev
0 upgraded, 17 newly installed, 0 to remove and 0 not upgraded.
Need to get 28.6 MB of archives.
After this operation, 48.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.team-cymru.org/ubuntu/ trusty/main libexpat1-dev amd64 2.1.0-4ubuntu1 [115 kB]
Get:2 http://mirror.team-cymru.org/ubuntu/ trusty/main libpython3.4-dev amd64 3.4.0-2ubuntu1 [27.0 MB]
Get:3 http://mirror.team-cymru.org/ubuntu/ trusty/main libpython3-dev amd64 3.4.0-0ubuntu2 [7,002 B]
Get:4 http://mirror.team-cymru.org/ubuntu/ trusty/universe python-colorama all 0.2.5-0.1ubuntu1 [18.3 kB]
Get:5 http://mirror.team-cymru.org/ubuntu/ trusty/universe python-distlib all 0.1.8-1 [113 kB]
Get:6 http://mirror.team-cymru.org/ubuntu/ trusty/main python-html5lib all 0.999-2 [83.2 kB]
Get:7 http://mirror.team-cymru.org/ubuntu/ trusty/main python-setuptools all 3.3-1ubuntu1 [230 kB]
Get:8 http://mirror.team-cymru.org/ubuntu/ trusty/main python-urllib3 all 1.7.1-1build1 [38.9 kB]
Get:9 http://mirror.team-cymru.org/ubuntu/ trusty/main python-requests all 2.2.1-1 [42.5 kB]
Get:10 http://mirror.team-cymru.org/ubuntu/ trusty/universe python-pip all 1.5.4-1 [97.7 kB]
Get:11 http://mirror.team-cymru.org/ubuntu/ trusty/universe python3-colorama all 0.2.5-0.1ubuntu1 [11.9 kB]
Get:12 http://mirror.team-cymru.org/ubuntu/ trusty/main python3.4-dev amd64 3.4.0-2ubuntu1 [425 kB]
Get:13 http://mirror.team-cymru.org/ubuntu/ trusty/main python3-dev amd64 3.4.0-0ubuntu2 [1,192 B]
Get:14 http://mirror.team-cymru.org/ubuntu/ trusty/universe python3-distlib all 0.1.8-1 [113 kB]
Get:15 http://mirror.team-cymru.org/ubuntu/ trusty/universe python3-html5lib all 0.999-2 [79.3 kB]
Get:16 http://mirror.team-cymru.org/ubuntu/ trusty/main python3-setuptools all 3.3-1ubuntu1 [144 kB]
Get:17 http://mirror.team-cymru.org/ubuntu/ trusty/universe python3-pip all 1.5.4-1 [80.4 kB]
Fetched 28.6 MB in 2min 18s (207 kB/s)                                         
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database ... 260300 files and directories currently installed.)
Preparing to unpack .../libexpat1-dev_2.1.0-4ubuntu1_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.1.0-4ubuntu1) ...
Selecting previously unselected package libpython3.4-dev:amd64.
Preparing to unpack .../libpython3.4-dev_3.4.0-2ubuntu1_amd64.deb ...
Unpacking libpython3.4-dev:amd64 (3.4.0-2ubuntu1) ...
Selecting previously unselected package libpython3-dev:amd64.
Preparing to unpack .../libpython3-dev_3.4.0-0ubuntu2_amd64.deb ...
Unpacking libpython3-dev:amd64 (3.4.0-0ubuntu2) ...
Selecting previously unselected package python-colorama.
Preparing to unpack .../python-colorama_0.2.5-0.1ubuntu1_all.deb ...
Unpacking python-colorama (0.2.5-0.1ubuntu1) ...
Selecting previously unselected package python-distlib.
Preparing to unpack .../python-distlib_0.1.8-1_all.deb ...
Unpacking python-distlib (0.1.8-1) ...
Selecting previously unselected package python-html5lib.
Preparing to unpack .../python-html5lib_0.999-2_all.deb ...
Unpacking python-html5lib (0.999-2) ...
Selecting previously unselected package python-setuptools.
Preparing to unpack .../python-setuptools_3.3-1ubuntu1_all.deb ...
Unpacking python-setuptools (3.3-1ubuntu1) ...
Selecting previously unselected package python-urllib3.
Preparing to unpack .../python-urllib3_1.7.1-1build1_all.deb ...
Unpacking python-urllib3 (1.7.1-1build1) ...
Selecting previously unselected package python-requests.
Preparing to unpack .../python-requests_2.2.1-1_all.deb ...
Unpacking python-requests (2.2.1-1) ...
Selecting previously unselected package python-pip.
Preparing to unpack .../python-pip_1.5.4-1_all.deb ...
Unpacking python-pip (1.5.4-1) ...
Selecting previously unselected package python3-colorama.
Preparing to unpack .../python3-colorama_0.2.5-0.1ubuntu1_all.deb ...
Unpacking python3-colorama (0.2.5-0.1ubuntu1) ...
Selecting previously unselected package python3.4-dev.
Preparing to unpack .../python3.4-dev_3.4.0-2ubuntu1_amd64.deb ...
Unpacking python3.4-dev (3.4.0-2ubuntu1) ...
Selecting previously unselected package python3-dev.
Preparing to unpack .../python3-dev_3.4.0-0ubuntu2_amd64.deb ...
Unpacking python3-dev (3.4.0-0ubuntu2) ...
Selecting previously unselected package python3-distlib.
Preparing to unpack .../python3-distlib_0.1.8-1_all.deb ...
Unpacking python3-distlib (0.1.8-1) ...
Selecting previously unselected package python3-html5lib.
Preparing to unpack .../python3-html5lib_0.999-2_all.deb ...
Unpacking python3-html5lib (0.999-2) ...
Selecting previously unselected package python3-setuptools.
Preparing to unpack .../python3-setuptools_3.3-1ubuntu1_all.deb ...
Unpacking python3-setuptools (3.3-1ubuntu1) ...
Selecting previously unselected package python3-pip.
Preparing to unpack .../python3-pip_1.5.4-1_all.deb ...
Unpacking python3-pip (1.5.4-1) ...
Processing triggers for doc-base (0.10.5) ...
Processing 1 added doc-base file...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libexpat1-dev:amd64 (2.1.0-4ubuntu1) ...
Setting up libpython3.4-dev:amd64 (3.4.0-2ubuntu1) ...
Setting up libpython3-dev:amd64 (3.4.0-0ubuntu2) ...
Setting up python-colorama (0.2.5-0.1ubuntu1) ...
Setting up python-distlib (0.1.8-1) ...
Setting up python-html5lib (0.999-2) ...
Setting up python-setuptools (3.3-1ubuntu1) ...
Setting up python-urllib3 (1.7.1-1build1) ...
Setting up python-requests (2.2.1-1) ...
Setting up python-pip (1.5.4-1) ...
Setting up python3-colorama (0.2.5-0.1ubuntu1) ...
Setting up python3.4-dev (3.4.0-2ubuntu1) ...
Setting up python3-dev (3.4.0-0ubuntu2) ...
Setting up python3-distlib (0.1.8-1) ...
Setting up python3-html5lib (0.999-2) ...
Setting up python3-setuptools (3.3-1ubuntu1) ...
Setting up python3-pip (1.5.4-1) ...
root@saurabh-ubuntu:/home/saurabh# pip3 install biopython
Downloading/unpacking biopython
  Downloading biopython-1.64.tar.gz (11.7MB): 11.7MB downloaded
  Running setup.py (path:/tmp/pip_build_root/biopython/setup.py) egg_info for package biopython

    warning: no previously-included files matching '.cvsignore' found under directory '*'
    warning: no previously-included files matching '*.pyc' found under directory '*'
Installing collected packages: biopython
  Running setup.py install for biopython
    building 'Bio.cpairwise2' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c Bio/cpairwise2module.c -o build/temp.linux-x86_64-3.4/Bio/cpairwise2module.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/Bio/cpairwise2module.o -o build/lib.linux-x86_64-3.4/Bio/cpairwise2.cpython-34m.so
    building 'Bio.trie' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -IBio -I/usr/include/python3.4m -c Bio/triemodule.c -o build/temp.linux-x86_64-3.4/Bio/triemodule.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -IBio -I/usr/include/python3.4m -c Bio/trie.c -o build/temp.linux-x86_64-3.4/Bio/trie.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/Bio/triemodule.o build/temp.linux-x86_64-3.4/Bio/trie.o -o build/lib.linux-x86_64-3.4/Bio/trie.cpython-34m.so
    building 'Bio.Nexus.cnexus' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c Bio/Nexus/cnexus.c -o build/temp.linux-x86_64-3.4/Bio/Nexus/cnexus.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/Bio/Nexus/cnexus.o -o build/lib.linux-x86_64-3.4/Bio/Nexus/cnexus.cpython-34m.so

    warning: no previously-included files matching '.cvsignore' found under directory '*'
    warning: no previously-included files matching '*.pyc' found under directory '*'
Successfully installed biopython
Cleaning up...
root@saurabh-ubuntu:/home/saurabh# python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Bio
>>> 
[3]+  Stopped                 python3
root@saurabh-ubuntu:/home/saurabh# 
2
ответ дан 22 July 2014 в 17:32

Обычно python-* пакеты предназначены к Python 2. X. Тех к Python 3 называют python3-*.

В Вашем случае пакет, в котором Вы нуждаетесь, не доступен, таким образом, необходимо будет установить его "вручную".

Это может быть легко достигнуто со следующим:

$ sudo apt-get install python3-dev python3-pip
$ sudo pip3 install biopython

, Если Вы не хотите, чтобы он был установлен в масштабе всей системы, можно использовать virtualenv:

$ virtualenv -p python3.3 some_location  # replace 3.3 with your version. 
$ source some_location/bin/activate
$ pip install biopython # python3-dev should be already installed.
1
ответ дан 22 July 2014 в 17:32

Другие вопросы по тегам:

Похожие вопросы: