我遇到了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'”来查看链接指向的位置。 –