为什么SQLAlchemy只在我的Python 2.7库中安装自己?

问题描述 投票:0回答:1

我在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$ 

python macos sqlalchemy
1个回答
1
投票

尝试

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
© www.soinside.com 2019 - 2024. All rights reserved.