简体   繁体   English

为什么SQLAlchemy仅将自身安装在我的Python 2.7库中?

[英]Why is SQLAlchemy only installing itself in my Python 2.7 library?

I am on MacOS. 我在MacOS上。

I am trying to write an ETL module for myself but I'm getting hung up on the fact that I cannot seem to get SQLAlchemy to install itself in my python 3.7 directory. 我试图为自己编写一个ETL模块,但我似乎无法让SQLAlchemy将其自身安装在我的python 3.7目录中,这让我感到困惑。 It is installing itself fine in my 2.7 folder, even when I specify: 即使我指定了以下内容,它也可以很好地安装在我的2.7文件夹中:

sudo pip3 install sqlalchemy

This is driving me nuts! 这真让我发疯! I'd love any advice on the matter. 我希望就此事提供任何建议。

Below is what I am doing exactly: 以下是我正在做的事情:

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$ 

Try 尝试

pip3 -V

which will give something like this 这会给这样的东西

pip 19.0.3 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip (python 2.7)

so you can know where your pip installation is. 这样您就可以知道pip的安装位置。 As an alternative to install the given module you can try 作为安装给定模块的替代方法,您可以尝试

python3 -m pip install sqlalchemy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM