首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >python 3.x在安装后没有名为sqlalchemy的模块

python 3.x在安装后没有名为sqlalchemy的模块
EN

Stack Overflow用户
提问于 2013-10-29 00:19:36
回答 3查看 11.3K关注 0票数 1

我试图用ubuntu 12.04为我的python 3.x安装sqlalchemy来与mysql数据库交互,但是当我导入sqlalchemy时,它显示没有名为sqlalchemy的模块。这是我在安装过程中所做的:

代码语言:javascript
复制
aoi@aoi:~$ sudo apt-get install python3-sqlalchemy
[sudo] password for aoi: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
libgio-cil libmono-corlib4.0-cil libmono-system-security4.0-cil libmono-system-xml4.0-  cil libmono-i18n-west4.0-cil cli-common guile-1.8-libs
libmono-system-configuration4.0-cil librhythmbox-core5 mono-runtime libgdu-gtk0  libavahi-ui-gtk3-0 mono-4.0-gac mono-gac
linux-headers-3.5.0-23-generic libglib2.0-cil linux-headers-3.5.0-23 libming1 thunderbird-globalmenu libmusicbrainz3-6 libmono-i18n4.0-cil
libmono-security4.0-cil libmono-system4.0-cil
Use 'apt-get autoremove' to remove them.
 Suggested packages:
 python-sqlalchemy-doc
 The following NEW packages will be installed:
 python3-sqlalchemy
 0 upgraded, 1 newly installed, 0 to remove and 81 not upgraded.
 Need to get 450 kB of archives.
 After this operation, 2,808 kB of additional disk space will be used.
 Get:1 http://ph.archive.ubuntu.com/ubuntu/ precise-updates/main python3-sqlalchemy all   0.7.4-1ubuntu0.1 [450 kB]
 Fetched 450 kB in 40s (11.0 kB/s)                                                                                                                    
 Selecting previously unselected package python3-sqlalchemy.
 (Reading database ... 346102 files and directories currently installed.)
 Unpacking python3-sqlalchemy (from .../python3-sqlalchemy_0.7.4-1ubuntu0.1_all.deb) ...
 Setting up python3-sqlalchemy (0.7.4-1ubuntu0.1) ...

我做错什么了吗?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-10-29 20:38:55

通过使用apt-get,您已经在Ubuntu的默认Python3的默认目录中安装了sqlalchemy,默认目录为3.2。如果您在目录/usr/lib/python3/dist-packages中搜索,您将找到sqlalchemy模块(或者直接输入locate sqlalchemy)。但是,这不是自定义Python查找其模块的地方。您需要下载源代码并使用正确的Python对其进行编译,类似于sqlalchemy的源代码目录中的/opt/python3.3/bin/python3.3 setup.py install。请参阅此处的说明:http://docs.python.org/3.3/install

票数 2
EN

Stack Overflow用户

发布于 2014-12-03 15:41:50

这让version0.8.4 for python 2.x ubuntu在保持软件包更新方面非常缓慢。

代码语言:javascript
复制
sudo apt-get install python3-sqlalchemy

因此,对于Python3/ Ubuntu,这里是如何安装sqlalchemy的最新版本

代码语言:javascript
复制
sudo apt-get install python3-pip
# Now you have pip3

sudo apt-get install python3-all-dev
# Required for sqlalchemy's c extensions to be installed

sudo pip3 install SQLAlchemy
# note using pip, not pip3, will install for Python 2.7

:~$ python3
>>> import sqlalchemy
>>> sqlalchemy.__version__
>>> '0.9.8'
>>> print("Who's the man?")
>>> You are baby!
>>> quit()
票数 5
EN

Stack Overflow用户

发布于 2016-04-09 15:53:36

似乎python3-sqlalchemy已经过时了。您可以尝试使用pip3获取最新版本。

代码语言:javascript
复制
sudo pip3 install sqlalchemy

应该能行得通。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19639939

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档