python - 为什么 SQLAlchemy 只安装在我的 Python 2.7 库中?
问题描述
我在 MacOS 上。
我正在尝试为自己编写一个 ETL 模块,但我对我似乎无法让 SQLAlchemy 自行安装在我的 python 3.7 目录中这一事实感到困惑。它在我的 2.7 文件夹中安装得很好,即使我指定:
sudo pip3 install sqlalchemy
这让我发疯!我很想对此事提出任何建议。
以下是我正在做的事情:
User-MacBook-Pro:2.7 User$ pip3 install sqlalchemy --user
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting sqlalchemy
Installing collected packages: sqlalchemy
Successfully installed sqlalchemy-1.3.2
User-MacBook-Pro:2.7 User$ python3
Python 3.7.3 (default, Mar 27 2019, 09:23:15)
[Clang 10.0.1 (clang-1001.0.46.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlalchemy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sqlalchemy'
>>>
User-MacBook-Pro:2.7 User$ pip3 uninstall sqlalchemy
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Uninstalling SQLAlchemy-1.3.2:
Would remove:
/Users/User/Library/Python/2.7/lib/python/site-packages/SQLAlchemy-1.3.2.dist-info/*
/Users/User/Library/Python/2.7/lib/python/site-packages/sqlalchemy/*
Proceed (y/n)? y
Successfully uninstalled SQLAlchemy-1.3.2
User-MacBook-Pro:2.7 User$
解决方案
尝试
pip3 -V
这将给出这样的东西
pip 19.0.3 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip (python 2.7)
这样你就可以知道你的 pip 安装在哪里。作为安装给定模块的替代方法,您可以尝试
python3 -m pip install sqlalchemy
推荐阅读
- c# - AES解密时出现异常
- python - 如何解决 python 说“WebDriverException:: unknown error: cannot determine loading status from no such execution context?”的问题?
- javascript - 如何获得“未触及”的窗口对象?
- zabbix - 如何在 zabbix 中监控 Linux 卸载/删除的文件系统
- android - 如果它是由系统为 STICKY 创建的,有没有办法在服务的 onStartCommand 中识别它?
- python - 如何正确使用浮点数作为基类并为新类定义方法?
- php - PHP - 覆盖特征内的静态变量
- elasticsearch - 是否有任何接近 MongDB 投影的 Elasticsearch 操作?
- reactjs - React 中的 Highcharts 动态数据获取
- javascript - 如何用手风琴制作滑块?