我遇到了python3的問題。由於某些原因,我無法弄清楚,python3中可用的模塊與通過pip3安裝的模塊不同。Python3沒有找到由pip3安裝的模塊
運行在終端的回報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.
nltk (3.2.2)
numpy (1.12.0)
pandas (0.19.2)
pip (9.0.1)
python-dateutil (2.6.0)
pytz (2016.10)
setuptools (25.2.0)
six (1.10.0)
wheel (0.29.0)
運行this script,看看哪些模塊python3
有可用的回報:
['cycler==0.10.0', 'matplotlib==1.5.3', 'nltk==3.2.1', 'numpy==1.11.2', 'pip==9.0.1', 'pyparsing==2.1.10', 'python-dateutil==2.6.0', 'pytz==2016.7', 'setuptools==18.2', 'six==1.10.0']
這兩個是不一樣的,我不知道爲什麼。例如,nltk
的版本較舊。缺少pandas
。
我已經安裝了python通過自制軟件,我通過Textmate2運行腳本。但是,當我通過python3
在終端中運行代碼時,我遇到了同樣的問題。無論PIP3和python3安裝在/usr/local/bin/
:
$ which python3 pip3
/usr/local/bin/python3
/usr/local/bin/pip3
而這也是該版本python3使用:
>>> import sys, os
>>> os.path.dirname(sys.executable)
'/usr/local/bin'
如果有人可以幫助我弄清楚爲什麼是這樣的情況,以及我如何修復它,我非常感謝幫助。
嘗試使用命令「ls -l'python3 pip3'」來查看鏈接指向的位置。 –