在尝试为Python3.4安装ipython时,我收到一条消息,表明它已经安装。
pip3 install ipython
Requirement already satisfied (use --upgrade to upgrade): ipython in /usr/local/lib/python3.4/site-packages
但是当我尝试用ipython3 notebook
运行它时,我得到了所有这些:
Traceback (most recent call last):
File "/usr/local/bin/ipython3", line 11, in <module>
sys.exit(start_ipython())
File "/usr/local/lib/python3.4/site-packages/IPython/__init__.py", line 120, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 573, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/terminal/ipapp.py", line 321, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/core/application.py", line 369, in initialize
self.parse_command_line(argv)
File "/usr/local/lib/python3.4/site-packages/IPython/terminal/ipapp.py", line 316, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 471, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 402, in initialize_subcommand
subapp = import_item(subapp)
File "/usr/local/lib/python3.4/site-packages/IPython/utils/importstring.py", line 42, in import_item
module = __import__(package, fromlist=[obj])
File "/usr/local/lib/python3.4/site-packages/IPython/html/notebookapp.py", line 67, in <module>
from .services.sessions.sessionmanager import SessionManager
File "/usr/local/lib/python3.4/site-packages/IPython/html/services/sessions/sessionmanager.py", line 7, in <module>
import sqlite3
File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named '_sqlite3'
假设最后一行是最重要的
ImportError: No module named '_sqlite3'
我尝试为它安装各种依赖项:
apt-get install sqlite3 libsqlite3-dev
当我尝试通过pip3 install pysqlite
安装Pysqlite时:
Collecting pysqlite
Using cached pysqlite-2.6.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-ggtq7_wu/pysqlite/setup.py", line 85
print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ggtq7_wu/pysqlite
但是已经安装了Sphinx。我甚至重新安装了它。
pip3 install sphinx
Requirement already satisfied (use --upgrade to upgrade): sphinx in /usr/local/lib/python3.4/site-packages
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.3 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): snowballstemmer>=1.1 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.11 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): babel>=1.3 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): sphinx-rtd-theme<0.2,>=0.1 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): alabaster<0.8,>=0.7 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): Pygments>=2.0 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): markupsafe in /usr/local/lib/python3.4/site-packages (from Jinja2>=2.3->sphinx)
Requirement already satisfied (use --upgrade to upgrade): pytz>=0a in /usr/local/lib/python3.4/site-packages (from babel>=1.3->sphinx)
因此我无法解决它,因为显然_sqlite3.so
中的文件/usr/local/lib/python3.4/lib-dynload
不存在,我找不到安装它的方法。
答案 0 :(得分:3)
由于我在评论中得到的帮助,我设法解决了这个问题
只是把它放在这里,以便让任何可能有同样问题的人轻松搞清楚最新情况。
问题是在安装sql dev文件之前使用Python的自编译版本。因此绑定没有采取。
首先,我必须使用sudo apt-get install sqlite3 libsqlite3-dev
来获取相关的sqlite文件。
然后我不得不使用Source Tarball重新编译Python并执行以下命令来重新编译它。
make clean
./configure
make
make install
答案 1 :(得分:-1)
我在CentOS 6.8上遇到了同样的问题,我安装了sqlite-devel
然后我重新编译了python并解决了问题:
yum install sqlite-devel