久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

GDBM 不適用于 Python 3.6 和 anaconda

GDBM doesn#39;t work with Python 3.6 and anaconda(GDBM 不適用于 Python 3.6 和 anaconda)
本文介紹了GDBM 不適用于 Python 3.6 和 anaconda的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我在 anaconda 環(huán)境中使用 Python 3.6.我用

I use Python 3.6 in an anaconda environment. I installed GDBM with

conda install gdbm

安裝很順利,但是我不能使用 Python 中的 dbm.gnu:

The installation went well, however I can't use dbm.gnu from Python:

ModuleNotFoundError: No module named '_gdbm'

看起來(lái) Python 不包含 _gdbm 模塊,即使實(shí)際安裝了 GDBM.

It seams that Python doesn't include the _gdbm module, even if GDBM is actually installed.

這是一個(gè)已知問(wèn)題嗎?我該如何解決?

Is this a known problem? How can I fix it?

謝謝!

推薦答案

我也遇到過(guò)這個(gè)問(wèn)題.這可能不是理想的方式,但它確實(shí)有效.我做了以下事情來(lái)解決這個(gè)問(wèn)題 -

I faced this issue as well. This is probably not the ideal way, but it works. I did the following to resolve this -

sudo apt-get install python3-gdbm

這會(huì)為 python3 安裝 gdbm 庫(kù),但是由于 apt-get 和 anaconda 是兩個(gè)獨(dú)立的包管理器;這不會(huì)解決你的問(wèn)題.我們這樣做主要是為了獲得 .so 共享庫(kù),我們將把它放在我們安裝的 anaconda 的正確文件夾中.接下來(lái)我們使用 -

This installs the gdbm library for python3, however since apt-get and anaconda are two independent package managers; this isn't going to solve your problem. We primarily do this to get a hold of the .so shared library which we will place in the right folder in our anaconda installation. Next we find the location of the .so file using -

dpkg -L python3-gdbm

這給了我們以下輸出 -

This gives us the following output -

/.
/usr
/usr/lib
/usr/lib/python3.5
/usr/lib/python3.5/lib-dynload
/usr/lib/python3.5/lib-dynload/_gdbm.cpython-35m-x86_64-linux-gnu.so
/usr/share
/usr/share/doc
/usr/share/doc/python3-gdbm
/usr/share/doc/python3-gdbm/copyright
/usr/share/doc/python3-gdbm/changelog.Debian.gz
/usr/share/doc/python3-gdbm/README.Debian

我們需要的文件在這里 -

The file we require is here -

/usr/lib/python3.5/lib-dynload/_gdbm.cpython-35m-x86_64-linux-gnu.so

將此文件復(fù)制到您安裝的 anaconda 的 lib-dynload 文件夾中;對(duì)我來(lái)說(shuō)這是 -

Copy this file to the lib-dynload folder of your anaconda installation; for me this was -

cp /usr/lib/python3.5/lib-dynload/_gdbm.cpython-35m-x86_64-linux-gnu.so /home/username/anaconda3/lib/python3.5/lib-dynload

注意,這只有在 .so 被復(fù)制到的目錄位于 python 的 sys.path 中時(shí)才有效.要找到要復(fù)制到的正確目錄,假設(shè)您在激活的 conda 環(huán)境中,請(qǐng)運(yùn)行:

Note, that this will only work if the directory the .so was copied to is in python's sys.path. To find the correct directory to copy to, assuming you're inside the activated conda environment, run:

python -c 'import sys; [print(x) for x in sys.path if "lib-dynload" in x]'

例如,在我的例子中,該目錄位于環(huán)境路徑中,而不是在 anaconda 主庫(kù)中.~/anaconda3/envs/myenvname/lib/python3.7/lib-dynload

For example, in my case, the directory was inside the environment path and not in the anaconda main library. ~/anaconda3/envs/myenvname/lib/python3.7/lib-dynload

現(xiàn)在嘗試在 python 中導(dǎo)入模塊 -

Now try importing the module in python -

from _gdbm import *

或從命令行測(cè)試它:

python -m dbm.gnu

這應(yīng)該解決了你的問(wèn)題.

This should have fixed your problem.

請(qǐng)注意,我的是 Ubuntu-16.06 操作系統(tǒng),我的 python 版本是 3.5.2..so 文件也可以與 python3.6 一起使用,如果不是,您可以嘗試安裝 python3.6-gdbm,盡管快速搜索 ubuntu 16.04 并沒(méi)有給我任何結(jié)果.

Please note, mine is an Ubuntu-16.06 OS and my python version is 3.5.2. The .so file may work with python3.6 as well, if not you can try installing python3.6-gdbm, although a quick search for ubuntu 16.04 didn't give me any results.

這篇關(guān)于GDBM 不適用于 Python 3.6 和 anaconda的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時(shí)出現(xiàn)問(wèn)題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節(jié)點(diǎn))
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應(yīng)并將元素值存儲(chǔ)在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標(biāo)記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對(duì)象)
主站蜘蛛池模板: 精品国产一区一区二区三亚瑟 | www日韩欧美 | 99草免费视频 | 国产色 | 久久久久国产精品一区二区 | 国产亚洲网站 | 国产成人综合一区二区三区 | 国产精品一区二区在线 | 精品亚洲国产成av人片传媒 | 免费欧美| 精品国产乱码久久久久久丨区2区 | 不卡视频在线 | 午夜视频在线观看网站 | 99精品一级欧美片免费播放 | 欧美一区在线视频 | 欧美高清hd | av在线一区二区三区 | 亚洲精品一 | 91观看 | 91在线精品视频 | 在线电影日韩 | 99re热精品视频国产免费 | 不卡一区二区三区四区 | 久久久久国产精品一区 | 国产亚洲第一页 | 久久久www成人免费精品 | 成人国产精品久久 | 日本不卡在线视频 | 久久99精品久久久久蜜桃tv | 日韩中文字幕在线视频 | 亚洲欧美在线视频 | 亚洲天堂男人的天堂 | 精品一区二区三区日本 | av在线播放不卡 | 黄色大片在线播放 | 在线观看av网站永久 | 国产亚洲成av人片在线观看桃 | 9色网站 | 亚洲视频一区 | 久草视频观看 | 国产激情视频在线免费观看 |