简体   繁体   English

python3.6-无法安装模块'_sqlite3'和'_bz2'

[英]python3.6 - can't install modules '_sqlite3' & '_bz2'

I'm using a Fedora distribution and working with python 3.6. 我正在使用Fedora发行版并使用python 3.6。

While importing both nltk and sklearn it says I'm missing said 2 modules (respectively). 在同时导入nltksklearn它说我分别缺少2个模块。 I tried fixing it by first downloading these modules using: sudo yum install sqlite-devel and sudo yum install bzip2-devel but got the following errors (respectively) 我尝试通过首先使用以下sudo yum install sqlite-devel下载这些模块来修复它: sudo yum install sqlite-develsudo yum install bzip2-devel但分别出现以下错误

Error downloading packages:
  sqlite-devel-3.7.17-8.el7.x86_64: [Errno 5] [Errno 2] No such file or directory
Error downloading packages:
  bzip2-devel-1.0.6-13.el7.x86_64: [Errno 5] [Errno 2] No such file or directory

What exactly do I need to do in order to install these modules? 为了安装这些模块,我到底需要做什么? I tried sniffing around Google and SO but couldn't find a resolution that worked for me. 我曾尝试过嗅探Google和SO,但找不到适合我的解决方案。

Please help! 请帮忙!

Edit: I understand that I need to re-compile python after installing said packages (not that I know how to re-compile it) but I can't even download these packages. 编辑:我知道安装上述软件包后需要重新编译python(不是我知道如何重新编译),但我什至无法下载这些软件包。

Did you tried: 您是否尝试过:

sudo dnf install bzip2 须藤dnf安装bzip2

To install basic SQLite (if it is not already), simply type: 要安装基本的SQLite(如果尚未安装),只需键入:

sudo dnf install sqlite or sudo yum install libsqlite3-dev sudo dnf安装sqlite或sudo yum安装libsqlite3-dev

This package provides the basic library and the command-line client sqlite. 该软件包提供了基本库和命令行客户端sqlite。 In order to access SQLite databases from various programming languages (C, Tcl, Java), the language bindings need to be installed separately: 为了从各种编程语言(C,Tcl,Java)访问SQLite数据库,需要单独安装语言绑定:

sudo dnf install sqlite-devel sqlite-tcl sqlite-jdbc 须藤dnf安装sqlite-devel sqlite-tcl sqlite-jdbc

好吧,我最终要做的是按照@Sidon的建议(在/ usr / lib / anaconda3中)安装anaconda并更改了python3的symbolinc( ln -s /usr/local/anaconda3/bin/python3.6 /usr/local/bin/python3 ),似乎ln -s /usr/local/anaconda3/bin/python3.6 /usr/local/bin/python3

Anaconda different envs: Anaconda不同的环境:

With anaconda you can install different envs and then change according to your necessity, for example: 使用anaconda,您可以安装不同的环境,然后根据需要进行更改,例如:

Install python 2.7 安装python 2.7

conda-env create -n py27 python=2.7

Install python 3.6 安装python 3.6

conda-env create -n p36 python=3.6

List environments installed 列出已安装的环境

conda-env list  

Output (my case): 输出(我的情况):

autopart                 /home/sidon/anaconda3/envs/autopart
eztables                 /home/sidon/anaconda3/envs/eztables
gestauto                 /home/sidon/anaconda3/envs/gestauto
llabs                    /home/sidon/anaconda3/envs/llabs
material                 /home/sidon/anaconda3/envs/material
olist                    /home/sidon/anaconda3/envs/olist
py27                     /home/sidon/anaconda3/envs/py27
scrum                    /home/sidon/anaconda3/envs/scrum
root                  *  /home/sidon/anaconda3

Change environment: 变更环境:

sidon@sidon-pc-linux:~$ source activate py27 <enter>
(py27) sidon@sidon-pc-linux:~$ 

Installing scikit on py27 在py27上安装scikit

$ source activate py27 <enter>
$ (py27) pip install scikit-learn  

or (if fail)
$ (py27) conda install scikit-learn

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM