最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]通过pip升级SQLAlchemy为最新的1.1版本

Python crifan 7455浏览 0评论

折腾:

[已解决]SQLAlchemy执行create_all初始化enum时出错:AttributeError: replace

期间,需要去通过pip升级SQLAlchemy为最新的1.1.0b3版本

此处,通过:

(SIPEvents) ➜  SIPEvents pip show flask

<div–<-

Metadata-Version: 2.0
Name: Flask
Version: 0.11.1
Summary: A microframework based on Werkzeug, Jinja2 and good intentions
Home-page: http://github.com/pallets/flask/
Author: Armin Ronacher
Author-email: [email protected]
Installer: pip
License: BSD
Location: /root/Envs/SIPEvents/lib/python2.7/site-packages
Requires: itsdangerous, Jinja2, Werkzeug, click
Classifiers:
  Development Status :: 4 – Beta
  Environment :: Web Environment
  Intended Audience :: Developers
  License :: OSI Approved :: BSD License
  Operating System :: OS Independent
  Programming Language :: Python
  Programming Language :: Python :: 2
  Programming Language :: Python :: 2.6
  Programming Language :: Python :: 2.7
  Programming Language :: Python :: 3
  Programming Language :: Python :: 3.3
  Programming Language :: Python :: 3.4
  Programming Language :: Python :: 3.5
  Topic :: Internet :: WWW/HTTP :: Dynamic Content
  Topic :: Software Development :: Libraries :: Python Modules
Entry-points:
  [console_scripts]
  flask=flask.cli:main
(SIPEvents) ➜  SIPEvents pip show flask-sqlalchemy

<div–<-

Metadata-Version: 2.0
Name: Flask-SQLAlchemy
Version: 2.1
Summary: Adds SQLAlchemy support to your Flask application
Home-page: http://github.com/mitsuhiko/flask-sqlalchemy
Author: Phil Howell
Author-email: [email protected]
Installer: pip
License: BSD
Location: /root/Envs/SIPEvents/lib/python2.7/site-packages
Requires: SQLAlchemy, Flask
Classifiers:
  Environment :: Web Environment
  Intended Audience :: Developers
  License :: OSI Approved :: BSD License
  Operating System :: OS Independent
  Topic :: Internet :: WWW/HTTP :: Dynamic Content
  Topic :: Software Development :: Libraries :: Python Modules
  Programming Language :: Python
  Programming Language :: Python :: 2
  Programming Language :: Python :: 2.6
  Programming Language :: Python :: 2.7
  Programming Language :: Python :: 3
  Programming Language :: Python :: 3.3
  Programming Language :: Python :: 3.4
(SIPEvents) ➜  SIPEvents pip show sqlalchemy      

<div–<-

Metadata-Version: 2.0
Name: SQLAlchemy
Version: 1.0.14
Summary: Database Abstraction Library
Home-page: http://www.sqlalchemy.org
Author: Mike Bayer
Author-email: [email protected]
Installer: pip
License: MIT License
Location: /root/Envs/SIPEvents/lib/python2.7/site-packages
Requires: 
Classifiers:
  Development Status :: 5 – Production/Stable
  Intended Audience :: Developers
  License :: OSI Approved :: MIT License
  Programming Language :: Python
  Programming Language :: Python :: 3
  Programming Language :: Python :: Implementation :: CPython
  Programming Language :: Python :: Implementation :: Jython
  Programming Language :: Python :: Implementation :: PyPy
  Topic :: Database :: Front-Ends
  Operating System :: OS Independent

才搞清楚:

不是去升级:

flask和flask-sqlalchemy,而是升级:

sqlalchemy

pip 升级

pip的安装,更新,卸载模块以及使用方法 python – Winterto1990的博客 – 博客频道 – CSDN.NET

pip升级安装 – cashcat的技术专栏 – 博客频道 – CSDN.NET

(SIPEvents) ➜  SIPEvents pip help install
Usage:   
  pip install [options] <requirement specifier> [package-index-options] …
  pip install [options] -r <requirements file> [package-index-options] …
  pip install [options] [-e] <vcs project url> …
  pip install [options] [-e] <local project path> …
  pip install [options] <archive url/path> …
Description:
  Install packages from:
  – PyPI (and other indexes) using requirement specifiers.
  – VCS project urls.
  – Local project directories.
  – Local or remote source archives.
  pip also supports installing from “requirements files”, which provide
  an easy way to specify a whole environment to be installed.
Install Options:
  -c, –constraint <file>     Constrain versions using the given constraints file. This option can be used multiple times.
  -e, –editable <path/url>   Install a project in editable mode (i.e. setuptools “develop mode”) from a local project path or a VCS
                              url.
  -r, –requirement <file>    Install from the given requirements file. This option can be used multiple times.
  -b, –build <dir>           Directory to unpack packages into and build in.
  -t, –target <dir>          Install packages into <dir>. By default this will not replace existing files/folders in <dir>. Use
                              –upgrade to replace existing packages in <dir> with new versions.
  -d, –download <dir>        Download packages into <dir> instead of installing them, regardless of what’s already installed.
  –src <dir>                 Directory to check out editable projects into. The default in a virtualenv is “<venv path>/src”. The
                              default for global installs is “<current dir>/src”.
  -U, –upgrade               Upgrade all specified packages to the newest available version. This process is recursive regardless of
                              whether a dependency is already satisfied.
  –force-reinstall           When upgrading, reinstall all packages even if they are already up-to-date.
  -I, –ignore-installed      Ignore the installed packages (reinstalling instead).
  –no-deps                   Don’t install package dependencies.
  –install-option <options>  Extra arguments to be supplied to the setup.py install command (use like –install-option=”–install-
                              scripts=/usr/local/bin”). Use multiple –install-option options to pass multiple options to setup.py
                              install. If you are using an option with a directory path, be sure to use absolute path.
  –global-option <options>   Extra global options to be supplied to the setup.py call before the install command.
  –user                      Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python
                              on Windows. (See the Python documentation for site.USER_BASE for full details.)
  –egg                       Install packages as eggs, not ‘flat’, like pip normally does. This option is not about installing *from*
                              eggs. (WARNING: Because this option overrides pip’s normal install logic, requirements files may not
                              behave as expected.)
  –root <dir>                Install everything relative to this alternate root directory.
  –prefix <dir>              Installation prefix where lib, bin and other top-level folders are placed
  –compile                   Compile py files to pyc
  –no-compile                Do not compile py files to pyc
  –no-use-wheel              Do not Find and prefer wheel archives when searching indexes and find-links locations. DEPRECATED in
                              favour of –no-binary.
  –no-binary <format_control>
                              Do not use binary packages. Can be supplied multiple times, and each time adds to the existing value.
                              Accepts either :all: to disable all binary packages, :none: to empty the set, or one or more package
                              names with commas between them. Note that some packages are tricky to compile and may fail to install
                              when this option is used on them.
  –only-binary <format_control>
                              Do not use source packages. Can be supplied multiple times, and each time adds to the existing value.
                              Accepts either :all: to disable all source packages, :none: to empty the set, or one or more package
                              names with commas between them. Packages without binary distributions will fail to install when this
                              option is used on them.
  –pre                       Include pre-release and development versions. By default, pip only finds stable versions.
  –no-clean                  Don’t clean up build directories.
  –require-hashes            Require a hash to check each requirement against, for repeatable installs. This option is implied when
                              any package in a requirements file has a –hash option.
Package Index Options (including deprecated options):
  -i, –index-url <url>       Base URL of Python Package Index (default https://pypi.python.org/simple).
  –extra-index-url <url>     Extra URLs of package indexes to use in addition to –index-url.
  –no-index                  Ignore package index (only looking at –find-links URLs instead).
  -f, –find-links <url>      If a url or path to an html file, then parse for links to archives. If a local path or file:// url that’s
                              a directory, then look for archives in the directory listing.
  –process-dependency-links  Enable the processing of dependency links.
General Options:
  -h, –help                  Show help.
  –isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, –verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, –version               Show version and exit.
  -q, –quiet                 Give less output.
  –log <path>                Path to a verbose appending log.
  –proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  –retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  –timeout <sec>             Set the socket timeout (default 15 seconds).
  –exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
  –trusted-host <hostname>   Mark this host as trusted, even though it does not have valid or any HTTPS.
  –cert <path>               Path to alternate CA bundle.
  –client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM
                              format.
  –cache-dir <dir>           Store the cache data in <dir>.
  –no-cache-dir              Disable the cache.
  –disable-pip-version-check
                              Don’t periodically check PyPI to determine whether a new version of pip is available for download.
                              Implied with –no-index.

结果竟然是已经是最新的了:

(SIPEvents) ➜  SIPEvents pip install -U sqlalchemy    
Requirement already up-to-date: sqlalchemy in /root/Envs/SIPEvents/lib/python2.7/site-packages

所以只能想办法去:

pip 升级 包 指定版本

python中包管理工具(easy_install和pip的用法) – Hello World! – 博客频道 – CSDN.NET

安装特定版本的package
通过使用==, >=, <=, >, <来指定一个版本号。
$ pip install ‘Markdown<2.0’
$ pip install ‘Markdown>2.0,<2.0.3’

然后去安装:

然后也在主页的下载地址中看到了这个最新的版本:

Download – SQLAlchemy

VERSION 1.1

Latest 1.1 Release: 1.1.0b3 (1.1.0b3 via Cheeseshop) (CHANGES)

SQLAlchemy 1.1.0b3 is signed using Michael Bayer’s PGP key id C4DAFEE1 (use gpg –recv-keys C4DAFEE1 to import).

Please be sure to review the 1.0 to 1.1 migration guide, found at What’s New in 1.1?, for full details on changes made since 1.0.

(SIPEvents) ➜  SIPEvents pip install ‘sqlalchemy==1.1.0b3’
Collecting sqlalchemy==1.1.0b3
  Downloading SQLAlchemy-1.1.0b3.tar.gz (5.1MB)
    100% |████████████████████████████████| 5.1MB 41kB/s 
Building wheels for collected packages: sqlalchemy
  Running setup.py bdist_wheel for sqlalchemy … done
  Stored in directory: /root/.cache/pip/wheels/f4/49/29/9399713981242167620c5241b38b07c05136d29f7c72e9decb
Successfully built sqlalchemy
Installing collected packages: sqlalchemy
  Found existing installation: SQLAlchemy 1.0.14
    Uninstalling SQLAlchemy-1.0.14:
      Successfully uninstalled SQLAlchemy-1.0.14
Successfully installed sqlalchemy-1.1.0b3

[总结]

如果只是想要升级到最新版本,则:

pip install -U package_name

比如:

pip install -U sqlalchemy

如果要指定某个版本:

pip install ‘package_name=x.x.x’

其中==可以换成:>,<,>=,<=

比如:

<code>pip install 'sqlalchemy==1.1.0b3'
</code>

转载请注明:在路上 » [已解决]通过pip升级SQLAlchemy为最新的1.1版本

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.177 seconds, using 22.14MB memory