您好,我刚刚开始使用python,并试图安装一些必需库。在OS X上使用Python3.4.1。我已经安装了PyPDF2 (假设成功),但我似乎不能使用这些工具:
sh-3.2# port select --list python
Available versions for python:
none
python25-apple
python26
python26-apple
python27-apple
python34 (active)
sh-3.2# pip install PyPDF2
Requirement already satisfied (use --upgrade to upgrade): PyPDF2 in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
Cleaning up...
sh-3.2#
..。
import PyPDF2
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import PyPDF2
ImportError: No module named 'PyPDF2'
>>>
我是不是漏掉了一步?或者在py3.4.1中不支持PyPDF2?
发布于 2014-08-12 04:08:41
PyPDF2兼容Python3.4,所以这不是问题所在。
在哪个Python版本中安装了pip?即使您使用的是python34
,如果pip安装到不同的版本,它也会将库下载到该版本。
在任何情况下,您都可以通过从PyPI下载,然后运行setup.py install
来安装。
不过,我唯一可能的解释是,您当前使用的Python版本没有安装PyPDF2。看看是否可以从任何其他版本导入PyPDF2。
发布于 2016-12-29 20:03:39
您可以使用以下命令安装PyPDF2。
pip install PyPDF2
发布于 2018-01-06 00:48:58
在我的例子中: pip3在/usr/ PyPDF2 /bin中使用python安装本地
[tim@axelrod utils] (hotfix/2.3.2)$ ls -l /usr/local/bin/python*
lrwxr-xr-x 1 root admin 22 10 May 2017 /usr/local/bin/python -> /usr/local/bin/python3
lrwxr-xr-x 1 tim admin 35 3 May 2017 /usr/local/bin/python3 -> ../Cellar/python3/3.6.1/bin/python3
lrwxr-xr-x 1 tim admin 42 3 May 2017 /usr/local/bin/python3-config -> ../Cellar/python3/3.6.1/bin/python3-config
lrwxr-xr-x 1 tim admin 37 3 May 2017 /usr/local/bin/python3.6 -> ../Cellar/python3/3.6.1/bin/python3.6
lrwxr-xr-x 1 tim admin 44 3 May 2017 /usr/local/bin/python3.6-config -> ../Cellar/python3/3.6.1/bin/python3.6-config
lrwxr-xr-x 1 tim admin 38 3 May 2017 /usr/local/bin/python3.6m -> ../Cellar/python3/3.6.1/bin/python3.6m
lrwxr-xr-x 1 tim admin 45 3 May 2017 /usr/local/bin/python3.6m-config -> ../Cellar/python3/3.6.1/bin/python3.6m-config
-rwxr-xr-x 1 tim wheel 4119 7 Jan 2012 /usr/local/bin/python_count
https://stackoverflow.com/questions/25224260
复制相似问题