
Ubuntu日本語フォーラム

ログインしていません。
Windows7 をホストとする VMware Player 上に Ubuntu 12.04 を一月七日にインストー
ルしました。本気で Linux を使うのは今回が初めてです。
Python の numpy, scipy, sympy package などを使う必要があり、EPD free バージョン
をダウンロードし、下のコマンドでインストールしました。
bash epd_free-7.3-2-rh5-x86.sh
これで EPD の Python はインストールされたのですが site-packages が lib ディレク
トリ以下にありません。 Third party の package が全くインストールされていません。
--------- 調べたこと begin -------------------
○ numpy モジュールがありません
cat temp.py
import numpy as md
print md
/home/kenji/download/epd_free-7.3-2-rh5-x86/bin/python temp.py
Traceback (most recent call last):
File "temp.py", line 1, in <module>
import numpy as md
ImportError: No module named numpy
○ numpy モジュールは egg しかありません
locate numpy
/home/kenji/download/epd_free-7.3-2-rh5-x86/LOCAL-REPO/numpy-1.6.1-0.egg
○ site-packages ディレクトリは /lib/pyhon2.7/ にインストーラーとしてあるだけです
locate -r \/home\/kenji\/.*\/site-package
/home/kenji/download/epd_free-7.3-2-rh5-x86/lib/python2.7/site-packages
/home/kenji/download/epd_free-7.3-2-rh5-x86/lib/python2.7/site-packages/README
/home/kenji/download/epd_free-7.3-2-rh5-x86/lib/python2.7/site-packages/egginst
snipped
/home/kenji/download/epd_free-7.3-2-rh5-x86/lib/python2.7/site-packages/enstaller/store/local.pyc
--------- 調べたこと end -------------------
site-packages をインストールする何かが EPD にあるのだと推測していますが、Google
しても それらしいものを見つけられません。
個別モジュールをインストールするのではなく EPD が集めてくれたものを一括してイン
ストールしようとしています。各 package の依存関係を固定するためです。
何か EPD の site-packages を纏めてインストールする方法について、よろしく御教示
願います。
オフライン
自己レスです。
egg file は既にあるのだから、それを手で一つづつ install していこうと考えまし
た。まず下により easy_install をインストールしましぬ。
kenji@kenji-virtual-machine:~$ sudo apt-get install python-setuptools
次に下のコマンドにより numpy をインストールしました。
kenji@kenji-virtual-machine:~$ sudo easy_install /home/kenji/download/epd_free-7.3-2-rh5-x86/LOCAL-REPO/numpy-1.6.1-0.egg
[sudo] password for kenji:
Processing numpy-1.6.1-0.egg
removing '/usr/local/lib/python2.7/dist-packages/numpy-1.6.1-0.egg' (and everything under it)
creating /usr/local/lib/python2.7/dist-packages/numpy-1.6.1-0.egg
Extracting numpy-1.6.1-0.egg to /usr/local/lib/python2.7/dist-packages
numpy 1.6.1 is already the active version in easy-install.pth
Installing f2py script to /usr/local/bin
Installed /usr/local/lib/python2.7/dist-packages/numpy-1.6.1-0.egg
Processing dependencies for numpy==1.6.1
Finished processing dependencies for numpy==1.6.1
応答をみているだけだと正しくインストールされたように見えます。でも実際には下の
ように numpy はインストールされていません。
kenji@kenji-virtual-machine:~$ locate numpy
/home/kenji/download/epd_free-7.3-2-rh5-x86/LOCAL-REPO/numpy-1.6.1-0.egg
kenji@kenji-virtual-machine:~$
何が拙いのかヒントだけでも貰えますでしょうか。
オフライン
自己レスです。
なんで locate numpy で応答しないか分かりませんが、応答の文言を見直してみると
EPD ではなく、元々の Python 側に numpy がインストール済みのようです。下のコー
ドを古い Python で動かしました。古い Python とは numpy package の相性が悪いよう
です。
//@@
import numpy
print 3+4
//@@@
Traceback (most recent call last):
File "temp.py", line 1, in <module>
import numpy
File "/usr/local/lib/python2.7/dist-packages/numpy-1.6.1-0.egg/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/usr/local/lib/python2.7/dist-packages/numpy-1.6.1-0.egg/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/dist-packages/numpy-1.6.1-0.egg/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/usr/local/lib/python2.7/dist-packages/numpy-1.6.1-0.egg/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/dist-packages/numpy-1.6.1-0.egg/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: /usr/local/lib/python2.7/dist-packages/numpy-1.6.1-0.egg/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS2_AsASCIIString
オフライン
Python の numpy, scipy, sympy package などを使う必要があり、EPD free バージョン
をダウンロードし、下のコマンドでインストールしました。
EPD Free自体が必要でないならば、ソフトウェアセンターにある物を使ってみるのも手かもしれません。
ソフトウェアセンターからnumpyで検索する。
(ウィンドウ左下の「**個のアイテムを表示する」をクリックしないとリストされない場合あり)
出てきた物から目的の物をクリックすれば詳細も見れますし、インストールもできます。
同様にscipy、sympyで検索する。
端末で操作するなら
$ apt-get search numpy リスト表示されるので必要な物をインストール $ sudo apt-get install python-numpy <-- python-numpyが必要な物だと判断した場合。
同様にscipy、sympyで検索する。
自己レスです。epd_free をインストールできました。要は「自分で
epd_free-7.3-2-rh5-x86.sh の中身を読んで、このインストール・ファイルがやろうと
していることを理解してから実行せよ」とのことのようです。
-------- epd_free インストール手順 begin -----------
mkdir my/PythonSf
mv /home/kenji/Downloads/epd_free-7.3-2-rh5-x86.sh /home/kenji/PythonSf my/PythonSf
kenji@kenji-virtual-machine:~/my/PythonSf$ bash epd_free-7.3-2-rh5-x86.sh
Welcome to the EPD_free-7.3-2 installer!
To continue the installation, you must review and approve the license term
agreement.
Press Enter to continue
snipped
Do you approve the license terms? [yes|no]
[no] >>> yes
EPD_free will be installed to this location:
/home/kenji/my/PythonSf/epd_free-7.3-2-rh5-x86
* Press Enter to accept this location
* Press CTRL-C to abort
* or specify an alternate location. Please ensure that your location
snipped
[/home/kenji/my/PythonSf/epd_free-7.3-2-rh5-x86] >>> ~/my/PythonSf/epd
Installing to /home/kenji/my/PythonSf/epd ... please wait
snipped
As the last step, you should edit your .bashrc or prepend
the EPD_free install path:
/home/kenji/my/PythonSf/epd/bin
Thank you for installing EPD_free!
kenji@kenji-virtual-machine:~/my/PythonSf$ export PATH=/home/kenji/my/PythonSf/epd/bin:$PATH
-------- epd_free インストール手順 end -----------
最後の PATH 設定がないと sys.path に新しくインストールした numpy などが反映されませんでした。
オフライン