久久久久久久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的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在 anaconda 環境中使用 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'

看起來 Python 不包含 _gdbm 模塊,即使實際安裝了 GDBM.

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

這是一個已知問題嗎?我該如何解決?

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

謝謝!

推薦答案

我也遇到過這個問題.這可能不是理想的方式,但它確實有效.我做了以下事情來解決這個問題 -

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

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

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

將此文件復制到您安裝的 anaconda 的 lib-dynload 文件夾中;對我來說這是 -

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 被復制到的目錄位于 python 的 sys.path 中時才有效.要找到要復制到的正確目錄,假設您在激活的 conda 環境中,請運行:

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]'

例如,在我的例子中,該目錄位于環境路徑中,而不是在 anaconda 主庫中.~/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

現在嘗試在 python 中導入模塊 -

Now try importing the module in python -

from _gdbm import *

或從命令行測試它:

python -m dbm.gnu

這應該解決了你的問題.

This should have fixed your problem.

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

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.

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

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

相關文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節點)
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 国产清纯白嫩初高生在线播放视频 | 手机av免费在线 | 欧美一区二区二区 | 国产视频福利一区 | 久久精品国产亚洲 | 久热久热 | 成人在线视频网址 | 中文字幕日韩一区 | 精品视频在线观看 | 成人网址在线观看 | 二区中文字幕 | 国产精品自拍视频 | 久久综合国产 | 狠狠久| 日韩中文字幕一区二区 | 国产视频1 | 久久精品99 | 国产精品一区二区三区在线 | 伊人网站在线观看 | 男女污污动态图 | 欧美激情精品久久久久 | 一区二区视频在线 | 偷拍自拍在线观看 | 免费国产成人av | 国产精品九九九 | 日韩欧美中文字幕在线观看 | 国产精品免费在线 | 九九热re | 欧美久久国产 | 日本电影免费完整观看 | 中文字幕在线观看日韩 | 欧美黑人激情 | 中文字幕高清 | 国产激情免费视频 | 精产国产伦理一二三区 | 国产成人区 | 日本在线免费视频 | av网站免费观看 | 91九色在线观看 | 中文字幕一区二区在线观看 | 国产伦精品一区二区三区精品视频 |