2017-10-04 32 views
0

Macでは、Python 3.6のセットアップをしようとしています。pipでインストールされたパッケージを見つけることができません。

Sams-MacBook-Pro:~ samgreenberg$ which pip3 
/Library/Frameworks/Python.framework/Versions/3.6/bin/pip3 
Sams-MacBook-Pro:~ samgreenberg$ which python3 
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 

その後、

Sams-MacBook-Pro:~ samgreenberg$ pip3 list 
DEPRECATION: The default format will switch to columns in the future. 

You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning. 
biopython (1.70) 
certifi (2017.7.27.1) 
chardet (3.0.4) 
cycler (0.10.0) 
decorator (4.1.2) 
idna (2.6) 
ipython-genutils (0.2.0) 
jsonschema (2.6.0) 
jupyter-core (4.3.0) 
matplotlib (2.0.2) 
nbformat (4.4.0) 
numpy (1.13.1) 
olefile (0.44) 
Pillow (4.3.0) 
pip (9.0.1) 
plotly (2.0.15) 
pyparsing (2.2.0) 
python-dateutil (2.6.1) 
pytz (2017.2) 
requests (2.18.4) 
setuptools (28.8.0) 
six (1.10.0) 
traitlets (4.3.2) 
urllib3 (1.22) 

のでbiopythonは

間違いなくインストール
Sams-MacBook-Pro:~ samgreenberg$ python3 -m pip install biopython 
Requirement already satisfied: biopython in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages 
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from biopython) 

をインストールしているようです。

Sams-MacBook-Pro:~ samgreenberg$ python3 
Python 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import urllib3 
>>> import biopython 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ModuleNotFoundError: No module named 'biopython' 
>>> 

urllib3は新しくインストールされたパッケージではなく動作します。 pipでアンインストールして再インストールしても何の効果もありませんでした。私は間違って何をしていますか?私は特にPythonやOSXに慣れていません。私のコンピュータにはPython 2.7がプリインストールされていましたが、私はこのコマンドでPython3を使用するよう注意しました。

答えて

2

私たちはいくつかのPythonモジュールを使用するとき、通常>>> import moduleと書いています。たとえば、>>> import urllib3です。しかし、biopythonを含むいくつかのパッケージは、このルール外です。 >>> import Bio>>> print(Bio.__version__)と入力してください。詳しくはhttp://biopython.org/DIST/docs/tutorial/Tutorial.htmlをご確認ください。

--original answer--

次のスクリプトを入力してみてください:

>>import sys 
>>print(sys.path) 

私はそこ/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packagesはありませんが、python2のモジュールパスだけだと思います。あなたは一時的にこの問題を解決したい場合は

、以下を使用してください:

>>sys.path.append("/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages") 

~/.bash_profilePYTHONPATHを定義し、あなたはいつものpython3を使用する場合は、あなたの端末を再起動してください:

PYTHONPATH=/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages:$PYTHONPATH 

+0

>>> import sys >>> print(sys.path) [''、 '/Library/Frameworks/Python.framework/Versions/3.6/lib/ python36.zip '、 ' /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6 '、 ' /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib- dynload '、 ' /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site- packages '] – Sam

+0

私はbiopythonとは何か誤解しました。いくつかのPythonモジュールを使うときは、通常、 '>>> import module'と書いています。たとえば、 '' >>> import urllib3'。しかし、biopythonを含むいくつかのパッケージは、このルール外です。あなたは '>>> import Bio'と' '>>> print(Bio .__ version __)'と入力しようとします。詳細は、[http://biopython.org/DIST/docs/tutorial/Tutorial.html](http://biopython.org/DIST/docs/tutorial/Tutorial.html)を参照してください。 – montblanc18

+0

ありがとう、私はドキュメントを読む必要があります。私はテストとして枕を試してみましたが、そのパッケージが異なる名前で輸入されていることを認識しない同じ結果がありました。 – Sam

関連する問題