我安装了pyenv来管理不同版本的Python,并使用pip install printtable
来下载和安装printtable
。ImportError:无法在Python 3.5.1中导入名称'PrintTable'by pyenv
但是,当我在交互式shell中导入该模块时,它不起作用并显示ImportError
。
$ pyenv versions
system
2.7.11
* 3.5.1 (set by /Users/apple/.pyenv/version)
$ pip list
pip (8.0.0)
printtable (1.2)
setuptools (18.2)
$ python
Python 3.5.1 (default, Jan 21 2016, 12:50:43)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import printtable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/apple/.pyenv/versions/3.5.1/lib/python3.5/site-packages/printtable/__init__.py", line 1, in <module>
from printtable import PrintTable
ImportError: cannot import name 'PrintTable'
如何在pyenv中管理模块?
PS。我正在按照步骤Automate the boring stuff
一步一步来。该printtable
部分是在第6章
访问结束:https://automatetheboringstuff.com/chapter6/
试着做一个“pip3安装打印表”,也许这将工作。 Pip最有可能安装了python2.x的库 – ishaan
'pip --version'告诉python版本的pip安装软件包。 –
是的,OP做到了。虽然OSX很可能有python2.x作为默认,所以点也可能指向该python。 – ishaan