python 环境管理笔记记录

因为之前线上的环境使用的全局的方式进行指定的版本安装了,后期不同的项目安装依赖不同的版本和依赖不同的相关的安装包的时候,就有点冲突,为了彼此相互隔离开。因为有必要需要进行多环境的安装和虚拟环境的创建。

首先我们需要处理的问题,就是关于系统多python版本的环境管理问题:

前提:当前的我的系统安装的版本是 python 3.5.4:

image.png

一、环境管理之pyenv 的使用(root下)

1:全家桶的方式脚本安装

$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

可能出现得问题:
问题1:git没有安装:

pyenv: Git is not installed, can't continue.
yum install git

问题2:

fatal: unable to access 'https://github.com/pyenv/pyenv.git/': Peer reports incompatible or unsupported protocol version.
或者
错误 0curl: (35) Network file descriptor is not connected

解决方法:

yum update -y nss curl libcurl 
再执行上述得脚本
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

问题3:

 Failed connect to raw.githubusercontent.com:443; Connection reset by peer

解决方案:


使用上面的优势在于:
1:一键安装,方便升级维护
2:它的安装是基于git的方式也可以保证当前安装的是最新版本的,对应的Python版本也是比较集全

2:添加pyenv命令道系统环境变量中

[root@localhost ~]# nano ~/.zshrc 

添加对于的内容为:

export PATH=$HOME/.pyenv/bin:$PATH
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

完成后直接进行保存退订,再执行生效的命令

[root@localhost ~]# source ~/.zshrc
[root@localhost ~]#

然后再编辑 ~/.bash_profile 文件

[root@localhost ~]# nano ~/.bash_profile

添加以下的脚本:

export PYENV_ROOT="/root/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi
image.png

完成后,pyenv就算正确安装完成了!

3:查看 pyenv 安装版本

[root@localhost ~]#  pyenv -v
pyenv 1.2.13
[root@localhost ~]# 

4:检测 pyenv 安装是否正常

[root@localhost ~]# pyenv doctor
Cloning /root/.pyenv/plugins/pyenv-doctor/bin/.....

BUILD FAILED (CentOS Linux 7 using python-build 1.2.13)

Problem(s) detected while checking system.

See https://github.com/pyenv/pyenv/wiki/Common-build-problems for known solutions.
[root@localhost ~]# 

5:pyenv 更新操作

[root@localhost ~]# pyenv update
Updating /root/.pyenv...
From https://github.com/pyenv/pyenv
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Updating /root/.pyenv/plugins/pyenv-doctor...
From https://github.com/pyenv/pyenv-doctor
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Updating /root/.pyenv/plugins/pyenv-installer...
From https://github.com/pyenv/pyenv-installer
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Updating /root/.pyenv/plugins/pyenv-update...
From https://github.com/pyenv/pyenv-update
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Updating /root/.pyenv/plugins/pyenv-virtualenv...
From https://github.com/pyenv/pyenv-virtualenv
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Updating /root/.pyenv/plugins/pyenv-which-ext...
From https://github.com/pyenv/pyenv-which-ext
 * branch            master     -> FETCH_HEAD
Already up-to-date.
[root@localhost ~]# 

二、pyenv 的使用一些简单命令使用

1:pyenv 查看相关的命令

[root@localhost ~]# pyenv -h
Usage: pyenv <command> [<args>]

Some useful pyenv commands are:
   commands    List all available pyenv commands
   local       Set or show the local application-specific Python version
   global      Set or show the global Python version
   shell       Set or show the shell-specific Python version
   install     Install a Python version using python-build
   uninstall   Uninstall a specific Python version
   rehash      Rehash pyenv shims (run this after installing executables)
   version     Show the current Python version and its origin
   versions    List all Python versions available to pyenv
   which       Display the full path to an executable
   whence      List all Python versions that contain the given executable

See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/pyenv/pyenv#readme
[root@localhost ~]# 

2:pyenv 查看可以安装的相关的包

[root@localhost ~]# pyenv install --list

3:pyenv 安装相关python版本包

[root@localhost ~]# pyenv install 3.6.6

遇到的问题点:蛋疼的很慢,很久·····
可以使用的取巧的方式进行先下载,再安装:
V是指定需要安装的版本信息:

[root@localhost ~]# v=3.7.3;wget http://npm.taobao.org/mirrors/python/$v/Python-$v.tar.xz -P ~/.pyenv/cache/;pyenv install $v 

安装出现问题ModuleNotFoundError: No module named '_ctypes':


解决问题:

1、执行如下命令:

yum install libffi-devel 

4:查看当前系统中所有可用的Python版本

[root@localhost ~]# pyenv versions
* system (set by /root/.pyenv/version)  #系统当前的版本
  3.6. 6 # 新安装的版本
  3.7.3  # 新安装的班
[root@localhost ~]# 

5:切换Python版本切换Python版本

(1)切换全局系统版本,即直接再shell下输入python的时候看到的系统版本
[root@localhost ~]# pyenv global 3.6.6
具体演示:
[root@localhost ~]# pyenv global 3.6. 6
pyenv: version `3.6.' not installed
[root@localhost ~]# pyenv global 3.6.6
[root@localhost ~]# python
Python 3.6.6 (default, Jul 25 2019, 05:52:01) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@localhost ~]# pyenv global 3.7.3 
[root@localhost ~]# python
Python 3.7.3 (default, Jul 25 2019, 05:48:21) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@localhost ~]# 
(2)指定的项目下目录下设置指定的python版本
root@localhost ~]# cd /data/www/ceshi/

#指定全局系统版本
[root@localhost ceshi]# pyenv global 3.6.6 

#设置当前data/www/ceshi、目录下的版本
[root@localhost ceshi]# pyenv local 3.7.3 

#查看设置后的版本情况
[root@localhost ceshi]# python
Python 3.7.3 (default, Jul 25 2019, 05:48:21) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()


\[root@localhost ceshi]# cd ~
#退出目录,查看全局的版本情况
[root@localhost ~]# python
Python 3.6.6 (default, Jul 25 2019, 05:52:01) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@localhost ~]# 
(3)取消指定的项目下目录下设置指定的python版本
pyenv local --unset
image.png

其他命令:


更新数据库
pyenv rehash 

 查看当前激活的是那个版本的Python
pyenv version

# 查看所有已安装的版本
pyenv versions

# 查看所有可安装的版本
pyenv install --list

# 安装指定版本
pyenv install 3.6.5
# 安装完成后必须rehash
pyenv rehash

# 删除指定版本
pyenv uninstall 3.5.2

# 指定局部版本,当前目录生效
pyenv local 3.6.5
pyenv local --unset

# 指定全局版本,整个系统生效
pyenv global 3.6.5

# 指定多个全局版本, 3版本优先
pyenv global 3.6.5 2.7.14

# 取消设置
pyenv local --unset

#PS: 切换版本后, 相应的pip和包仓库都是会自动切换过去的
参考:https://www.jianshu.com/p/1c8b942d0afc

三、pyenv 创建虚拟环境(使用pipevn来管理)

1:pyenv下pipevn 安装

(1)先查看当前pip版本
[root@localhost ~]# pip -V
pip 10.0.1 from /root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pip (python 3.6)
[root@localhost ~]# 

注释: from /root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pip (python 3.6) 因为我们上一步的操作中设置了全局python环境为3.6的
我们先切换为以前系统设置的环境:

[root@localhost ~]# pyenv global system 
[root@localhost ~]# pip -V
pip 9.0.1 from /usr/local/lib/python3.5/site-packages (python 3.5)
[root@localhost ~]# 
(2)升级当前系统下pip版本
[root@localhost ~]# pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Downloading https://files.pythonhosted.org/packages/62/ca/94d32a6516ed197a491d17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 123kB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-19.2.1
[root@localhost ~]# 
(3)安装最新的版本的 pipenv
[root@localhost ~]# pip install pipenv
Requirement already satisfied: pipenv in /usr/local/lib/python3.5/site-packages (2018.11.26)
Requirement already satisfied: pip>=9.0.1 in /usr/local/lib/python3.5/site-packages (from pipenv) (19.2.1)
Requirement already satisfied: certifi in /usr/local/lib/python3.5/site-packages (from pipenv) (2017.11.5)
Requirement already satisfied: virtualenv in /usr/local/lib/python3.5/site-packages (from pipenv) (16.4.0)
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.5/site-packages (from pipenv) (40.8.0)
Requirement already satisfied: virtualenv-clone>=0.2.5 in /usr/local/lib/python3.5/site-packages (from pipenv) (0.5.1)
[root@localhost ~]# 

提示已安装,应该是之前我以及安装过了!

(4) pipenv 帮助信息
[root@localhost ~]# pipenv
Usage: pipenv [OPTIONS] COMMAND [ARGS]...

Options:
  --where             Output project home information.
  --venv              Output virtualenv information.
  --py                Output Python interpreter information.
  --envs              Output Environment Variable options.
  --rm                Remove the virtualenv.
  --bare              Minimal output.
  --completion        Output completion (to be eval'd).
  --man               Display manpage.
  --support           Output diagnostic information for use in GitHub issues.
  --site-packages     Enable site-packages for the virtualenv.  [env var:
                      PIPENV_SITE_PACKAGES]
  --python TEXT       Specify which version of Python virtualenv should use.
  --three / --two     Use Python 3/2 when creating virtualenv.
  --clear             Clears caches (pipenv, pip, and pip-tools).  [env var:
                      PIPENV_CLEAR]
  -v, --verbose       Verbose mode.
  --pypi-mirror TEXT  Specify a PyPI mirror.
  --version           Show the version and exit.
  -h, --help          Show this message and exit.


Usage Examples:
   Create a new project using Python 3.7, specifically:
   $ pipenv --python 3.7

   Remove project virtualenv (inferred from current directory):
   $ pipenv --rm

   Install all dependencies for a project (including dev):
   $ pipenv install --dev

   Create a lockfile containing pre-releases:
   $ pipenv lock --pre

   Show a graph of your installed dependencies:
   $ pipenv graph

   Check your installed dependencies for security vulnerabilities:
   $ pipenv check

   Install a local setup.py into your virtual environment/Pipfile:
   $ pipenv install -e .

   Use a lower-level pip command:
   $ pipenv run pip freeze

Commands:
  check      Checks for security vulnerabilities and against PEP 508 markers
             provided in Pipfile.
  clean      Uninstalls all packages not specified in Pipfile.lock.
  graph      Displays currently-installed dependency graph information.
  install    Installs provided packages and adds them to Pipfile, or (if no
             packages are given), installs all packages from Pipfile.
  lock       Generates Pipfile.lock.
  open       View a given module in your editor.
  run        Spawns a command installed into the virtualenv.
  shell      Spawns a shell within the virtualenv.
  sync       Installs all packages specified in Pipfile.lock.
  uninstall  Un-installs a provided package and removes it from Pipfile.
  update     Runs lock, then sync.
[root@localhost ~]# 

2:pyenv下pipevn 使用

(1)为项目创建虚拟环境
Virtualenv location: /root/.local/share/virtualenvs/flower_admin_api-bTNBUh3c

说明:默认的情况,虚拟环境创建目录是在:~/.local/share/virtualenvs

如果是需要指定再每个项目根目录下创建和保持虚拟环境目录(.venv)的话,需要再 .bashrc 或 .bash_profile 中配置配置 相关的信息:

export PIPENV_VENV_IN_PROJECT=1

PS:=号不能有空格不然会报错

-bash: export: `=1': not a valid identifier

然后执行下 source ~/.bashrc或者 source ~/.bash_profile即可生效!

示例如:我需要再我的ceshi目录下创建虚拟环境:

尝试安装一个不存在的版本:

[root@localhost ceshi]# pipenv --python 3.6.7
Warning: Python 3.6.7 was not found on your system鈥
Would you like us to install CPython 3.6.7 with pyenv? [Y/n]: n
You can specify specific versions of Python with:
  $ pipenv --python path/to/python

安装一个已经存在的pyeven的版本:

[root@localhost ceshi]# pipenv --python 3.6.6
Creating a virtualenv for this project鈥[39m
Pipfile: /data/www/ceshi/Pipfile
Using /root/.pyenv/versions/3.6.6/bin/python3.6 (3.6.6) to create virtualenv鈥[39m
鉅[0m Creating virtual environment...Using base prefix '/root/.pyenv/versions/3.6.6'
New python executable in /data/www/ceshi/.venv/bin/python3.6
Also creating executable in /data/www/ceshi/.venv/bin/python
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /root/.pyenv/versions/3.6.6/bin/python3.6

鉁Successfully created virtual environment! 
Virtualenv location: /data/www/ceshi/.venv
Creating a Pipfile for this project鈥[39m
[root@localhost ceshi]# 

第一次在项目中运行 pipenv 命令,会在项目中创建一个名为 Pipfile 的文件,
[root@localhost ceshi]# ll
total 8
-rw-r--r--. 1 root root 138 Jul 25 22:56 Pipfile
-rw-r--r--. 1 root root 284 Dec 20  2018 sck.py
[root@localhost ceshi]# 

Pipfile文件内容类似下面这样。查看生成的文件:

[root@localhost ceshi]# cat Pipfile 
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]

[requires]
python_version = "3.6"
[root@localhost ceshi]# 

因为我们的安装的像的依赖包的时候,走国外的地址的话,你懂的!超级慢!所以需要修改为国内的!

[[source]]
name = "pypi"
url = "https://pypi.tuna.tsinghua.edu.cn/simple"

国内源的选择

阿里云:http://mirrors.aliyun.com/pypi/simple/ 
豆瓣:http://pypi.douban.com/simple/ 
清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/ 
中国科学技术大学:https://pypi.mirrors.ustc.edu.cn/simple/

关于更换源地址问题:更换的时候 记得也要HTTPS,不要会出现下面的错误提示:

image.png

更换之后,:


gen
image.png
(2)为项目安装相关的依赖(注意是在当前的项目目录下操作)
pipenv install flask
指定版本
pipenv install flask==x.x.x

#卸载
pipenv uninstall flask

安装完成会有新的文件生成:


image.png

PS:Pipfile.lock文件,类似npm中的lock文件 而Pipfile 类似npm 中的 package.json 文件

有了上面这两个文件之后。以后安装就访问了, 只需要拷贝了项目,然后再执行:

pipenv install
(3)更新项目相关的依赖(注意是在当前的项目目录下操作)
查看所有需要更新的包:
pipenv update -- outdated
更新所有包:
pipenv update
更新指定的包:
pipenv update <包名>
(4) 查看已安装的包相关的依赖(注意是在当前的项目目录下操作)
[root@localhost ceshi]# pipenv graph
requests==2.22.0
  - certifi [required: >=2017.4.17, installed: 2019.6.16]
  - chardet [required: >=3.0.2,<3.1.0, installed: 3.0.4]
  - idna [required: >=2.5,<2.9, installed: 2.8]
  - urllib3 [required: >=1.21.1,<1.26,!=1.25.1,!=1.25.0, installed: 1.25.3]
[root@localhost ceshi]# 
(5) 启动shell(注意是在当前的项目目录下操作)
[root@localhost ceshi]# pipenv shell
Launching subshell in virtual environment鈥
[root@localhost ceshi]#  . /data/www/ceshi/.venv/bin/activate
(ceshi) [root@localhost ceshi]#
(6) 运行脚本(注意是在当前的项目目录下操作)
如果你不想每次运行Python时都输入这么多,你可以在shell中设置一个别名,例如,

alias prp="pipenv run python"
image.png
(7) 退出当前虚拟环境(激活后的退出)脚本(注意是在当前的项目目录下操作)
(ceshi) [root@localhost ceshi]# exit
exit
[root@localhost ceshi]# 
(8) 查找虚拟环境的路径(注意是在当前的项目目录下操作)
[root@localhost ceshi]#pipenv --venv
/data/www/ceshi/.venv
[root@localhost ceshi]# 

其他常用命令:

(9) 删除该项目的虚拟环境(注意是在当前的项目目录下操作)
pipenv --rm
(10) lock这一步耗时较长(注意是在当前的项目目录下操作)

安装时用:pipenv install --skip-lock xxxxx, 等到要部署或git push时再运行pipenv lock生成Pipfile.lock文件,例如

pipenv install --skip-lock xxxxx
pipenv lock

pipenv install --skip-lock flask-jwt-extended==3.12.1


pipenv install --skip-lock django

https://www.cnblogs.com/PyKK2019/p/10787289.html.png
pip freeze > requirements.txt
pipenv install -r requirements.txt

四、pipevn在pycharm上的使用创建虚拟环境(使用pipevn来管理)

pychram 的Terminal里操作:

image.png
(venv) D:\code\python\local_python\afinlflask>pip -V
pip 19.0.3 from D:\code\python\local_python\lin-cms-flask-master03\venv\lib\site-packages\pip-19.0.3-py3.6.egg\pip (python 3.6)

(venv) D:\code\python\local_python\afinlflask>

目前我们的当前的项目是已经在使用了虚拟环境了,但是我需要使用pipevn来创建,方便上传到服务器的时候直接的使用pipevn install 安装管理

先退出当前虚拟环境:因为我们使用的是virtualenv 来创建,所以可以直接使用virtualenv 相关的命令退出:

(venv) D:\code\python\local_python\afinlflask>deactivate
D:\code\python\local_python\afinlflask>

先退出当前的虚拟环境后后,再系统的环境下安装对于的pipevn:

(venv) D:\code\python\local_python\afinlflask>deactivate
D:\code\python\local_python\afinlflask>

升级pip:

D:\code\python\local_python\afinlflask>pip install --upgrade pip
Requirement already up-to-date: pip in c:\users\mayn\appdata\local\programs\python\python35-32\lib\site-packages (19.2.1)

D:\code\python\local_python\afinlflask>

执行安装相关的版本之后:

D:\code\python\local_python\afinlflask>pipenv --python xxxxxx
image.png
image.png
1:激活
D:\code\python\local_python\afinlflask>pipenv shell
Launching subshell in virtual environment…
Microsoft Windows [版本 10.0.17763.615]
(c) 2018 Microsoft Corporation。保留所有权利。

(afinlflask-iEDkaE3F) D:\code\python\local_python\afinlflask>

2:退出
(afinlflask-iEDkaE3F) D:\code\python\local_python\afinlflask>exit
3:安装多个版本
D:\code\python\local_python\afinlflask>pipenv --python 3.6
Virtualenv already exists!
Removing existing virtualenv…
Creating a virtualenv for this project…
Pipfile: D:\code\python\local_python\afinlflask\Pipfile
Using C:/Users/mayn/AppData/Local/Programs/Python/Python36/python.exe (3.6.7) to create virtualenv…
[=   ] Creating virtual environment...Already using interpreter C:\Users\mayn\AppData\Local\Programs\Python\Python36\python.exe
Using base prefix 'C:\\Users\\mayn\\AppData\\Local\\Programs\\Python\\Python36'
New python executable in C:\Users\mayn\.virtualenvs\afinlflask-iEDkaE3F\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter C:/Users/mayn/AppData/Local/Programs/Python/Python36/python.exe

Successfully created virtual environment!
Virtualenv location: C:\Users\mayn\.virtualenvs\afinlflask-iEDkaE3F
Warning: Your Pipfile requires python_version 3.7, but you are using 3.6.7 (C:\Users\mayn\.\a\S\python.exe).
  $ pipenv --rm and rebuilding the virtual environment may resolve the issue.
  $ pipenv check will surely fail.

D:\code\python\local_python\afinlflask>

提示告警:

Warning: Your Pipfile requires python_version 3.7, but you are using 3.6.7 (C:\Users\mayn\.\a\S\python.exe).
  $ pipenv --rm and rebuilding the virtual environment may resolve the issue.
  $ pipenv check will surely fail.
3:手动删除pipfile 文件后。再 安装3.6
Successfully created virtual environment!
Virtualenv location: C:\Users\mayn\.virtualenvs\afinlflask-iEDkaE3F
Creating a Pipfile for this project…

D:\code\python\local_python\afinlflask>

image.png
4:显示当前虚拟环境所用的解释器位置
D:\code\python\local_python\afinlflask>pipenv --venv
C:\Users\mayn\.virtualenvs\afinlflask-iEDkaE3F

D:\code\python\local_python\afinlflask>

5:选择刚创建成功的虚拟环境
image.png
image.png

提示错误:


image.png

重新再选择其他:

image.png
image.png

重新的使用pipevn安装相关的依赖包

D:\code\python\local_python\afinlflask>pipenv install
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (ca72e7)!
Installing dependencies from Pipfile.lock (ca72e7)…
  ================================ 0/0 - 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

D:\code\python\local_python\afinlflask>

将当前使用 requirements.txt 文件的项目转换为使用 Pipenv,请安装 Pipenv 并运行:

D:\code\python\local_python\afinlflask>pipenv shell

(afinlflask-iEDkaE3F) D:\code\python\local_python\afinlflask>pipenv install requirements.txt

提示错误:


image.png

再不行:就根据pythcrm提示的进行安装:

直接修改Pipfile文件,然后执行安装的会会报错:

[root@localhost mml]# pipenv install
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/pipenv/project.py", line 527, in _parse_pipfile
    return tomlkit.parse(contents)
  File "/usr/local/lib/python3.5/site-packages/pipenv/vendor/tomlkit/api.py", line 49, in parse
    return Parser(string).parse()
  File "/usr/local/lib/python3.5/site-packages/pipenv/vendor/tomlkit/parser.py", line 146, in parse
    key, value = self._parse_table()
  File "/usr/local/lib/python3.5/site-packages/pipenv/vendor/tomlkit/parser.py", line 958, in _parse_table
    item = self._parse_item()
  File "/usr/local/lib/python3.5/site-packages/pipenv/vendor/tomlkit/parser.py", line 270, in _parse_item
    return self._parse_key_value(True)
  File "/usr/local/lib/python3.5/site-packages/pipenv/vendor/tomlkit/parser.py", line 347, in _parse_key_value
    raise self.parse_error(UnexpectedCharError, "=")
tomlkit.exceptions.UnexpectedCharError: Unexpected character: '=' at line 9 col 23

批量安装:

方式1:
pipenv install -r requirements.txt
方式2:

pipenv install amqp==1.4.9 ansimarkup==1.4.0 anyjson==0.3.3 better-exceptions-fork==0.2.1.post6 billiard==3.3.0.23 blinker==1.4 cacheout==0.11.1 celery==3.1.18 celery-once==3.0.0 celery-with-redis==3.0 certifi==2019.3.9 chardet==3.0.4 Click==7.0 colorama==0.4.1 crcmod==1.7 cymysql==0.9.13 Flask==1.0.2 Flask-Caching==1.7.2 Flask-Cors==2.1.0 Flask-Excel==0.0.7 Flask-JWT-Extended==3.12.1 Flask-Limiter==1.0.1 flask-sqlacodegen==1.1.6.1 Flask-SQLAlchemy==2.3.2 Flask-WTF==0.14.2 idna==2.6 inflect==2.1.0 itsdangerous==1.1.0 Jinja2==2.10 jmespath==0.9.4 kombu==3.0.37 limits==1.3 Lin-CMS==0.1.1b3 lml==0.0.9 loguru==0.2.5 MarkupSafe==1.1.1 oss2==2.6.1 peewee==3.6.4 pipfile==0.0.2 psycopg2==2.8.2 pycryptodome==3.8.1 pyexcel==0.5.15 pyexcel-io==0.5.20 pyexcel-webio==0.1.4 Pygments==2.4.0 PyJWT==1.7.1 pytz==2019.1 redis==2.10.6 requests==2.18.4 six==1.12.0 SQLAlchemy==1.2.11 texttable==1.6.2 toml==0.10.0 urllib3==1.22 vine==1.3.0 Werkzeug==0.14.1 WTForms==2.2.1 xlwt==1.3.0

其他:

pipenv run pip install pip==18.0

参考:
https://www.jianshu.com/p/7b190930adcf
https://www.jianshu.com/p/1c8b942d0afc
https://www.cnblogs.com/PyKK2019/p/10787289.html
https://www.jianshu.com/p/07c467f339ea

辅助:
pyenv virtualenv 3.7.1 TEST
pyenv activate TEST
pyenv deactivate
pyenv uninstall TEST

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
禁止转载,如需转载请通过简信或评论联系作者。
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,015评论 4 362
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,262评论 1 292
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,727评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,986评论 0 205
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,363评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,610评论 1 219
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,871评论 2 312
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,582评论 0 198
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,297评论 1 242
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,551评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,053评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,385评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,035评论 3 236
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,079评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,841评论 0 195
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,648评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,550评论 2 270

推荐阅读更多精彩内容