首页 > 其他分享 >Flask学习记录-pipenv虚拟环境搭建

Flask学习记录-pipenv虚拟环境搭建

时间:2024-03-27 22:57:43浏览次数:22  
标签:test1 pipenv Flask -- 虚拟环境 flask Pipfile packages

python环境

$ python -V
Python 3.9.18
1.安装pipenv $ pip install pipenv -i https://pypi.tuna.tsinghua.edu.cn/simple $ pipenv --version pipenv, version 2023.12.1
2.创建虚拟环境 [ flask-test1]$ pipenv install Creating a virtualenv for this project... Pipfile: /usr/dog/flask_web/flask-test1/Pipfile Using default python from /usr/bin/python3 (3.9.18) to create virtualenv... ⠦ Creating virtual environment...created virtual environment CPython3.9.18.final.0-64 in 423ms creator CPython3Posix(dest=/usr/dog/.local/share/virtualenvs/flask-test1-VWpTGuDs, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/usr/dog/.local/share/virtualenv) added seed packages: pip==24.0, setuptools==69.1.0, wheel==0.42.0 activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator ✔ Successfully created virtual environment! Virtualenv location: /usr/dog/.local/share/virtualenvs/flask-test1-VWpTGuDs Creating a Pipfile for this project... Pipfile.lock not found, creating... Locking [packages] dependencies... Locking [dev-packages] dependencies... Updated Pipfile.lock (a36a5392bb1e8bbc06bfaa0761e52593cf2d83b486696bf54667ba8da616c839)! Installing dependencies from Pipfile.lock (16c839)... To activate this project's virtualenv, run pipenv shell. Alternatively, run a command inside the virtualenv with pipenv run.
3.激活虚拟环境 [ flask-test1]$ pipenv shell Launching subshell in virtual environment... [dog@iZfkm309huj7srZ flask-test1]$ . /usr/dog/.local/share/virtualenvs/flask-test1-VWpTGuDs/bin/activate (flask-test1) [ flask-test1]$ pip list Package Version ---------- ------- pip 24.0 setuptools 69.1.0 wheel 0.42.0 4.退出虚拟环境 (flask-test1) [ flask-test1]$ exit exit [ flask-test1]$ pipenv -h 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. --man Display manpage. --support Output diagnostic information for use in GitHub issues. --site-packages / --no-site-packages Enable site-packages for the virtualenv. [env var: PIPENV_SITE_PACKAGES] --python TEXT Specify which version of Python virtualenv should use. --clear Clears caches (pipenv, pip). [env var: PIPENV_CLEAR] -q, --quiet Quiet mode. -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 PyUp Safety 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. requirements Generate a requirements.txt from Pipfile.lock. run Spawns a command installed into the virtualenv. scripts Lists scripts in current environment config. shell Spawns a shell within the virtualenv. sync Installs all packages specified in Pipfile.lock. uninstall Uninstalls a provided package and removes it from Pipfile. update Runs lock, then sync. upgrade Resolves provided packages and adds them to Pipfile, or (if no packages are given), merges results to Pipfile.lock verify Verify the hash in Pipfile.lock is up-to-date.

 

标签:test1,pipenv,Flask,--,虚拟环境,flask,Pipfile,packages
From: https://www.cnblogs.com/jackbond/p/18100502

相关文章

  • PIP换源,虚拟环境以及pycharm操作
    ​PIP换源,虚拟环境以及pycharm操作1PIP换源我们使用的很多包就是第三方的,需要命令安装,导入使用,国内访问国外的资源,慢并且有可能会访问不到所以要进行pip换源。默认pip就是使用的外网地址https://python.org/1.1临时换源p......
  • 如何用Flask中的Blueprints构建大型Web应用
    本文分享自华为云社区《构建大型Web应用Flask中的Blueprints指南》,作者:柠檬味拥抱。什么是Blueprints?Blueprints是Flask中的一种模式,用于将应用程序分解为可重用的模块。每个蓝图实际上是一个包含一组路由、视图和静态文件的Python模块。通过使用蓝图,我们可以将相关功能的代码......
  • 恶意代码分析实战——第二章 虚拟环境搭建
    防止部分恶意代码存在跨网络感染宿主机的情况。创建虚拟网络,一个虚拟机可以同来运行恶意代码,而第二个虚拟机则提供一些必要的网络服务。两个虚拟机都被连接到同一个VMNet虚拟交换机上。我这里使用WIN7进行分析恶意代码,Kali进行提供网络服务。一、在VMwareWorkstation菜单栏......
  • 【python】flask执行上下文context,请求上下文和应用上下文原理解析
    ✨✨欢迎大家来到景天科技苑✨✨......
  • Python Flask框架 -- ORM模型外键与表关系
    表关系关系型数据库一个强大的功能,就是多个表之间可以建立关系。比如文章表中,通常需要保存作者数据,但是我们不需要直接把作者数据放到文章表中,而是通过外键引用用户表。这种强大的表关系,可以存储非常复杂的数据,并且可以让查询非常迅速。在Flask-SQLAlchemy中,同样也支持表关系......
  • Flask项目实现-新闻首页
    点击排行展示在请求根路由时去数据库查询按点击量排行的10条新闻新闻new模型设计classNews(BaseModel,db.Model):"""新闻"""__tablename__="info_news"id=db.Column(db.Integer,primary_key=True)#新闻编号title=db.Column(db.String(2......
  • Flask项目实战之-注册实现
    注册后端实现 passport/register请求方式:POST传入参数:JSON格式参数参数名类型是否必须参数说明mobilestring是手机号smscodestring是短信验证码passwordstring是密码返回类型:JSON参数名类型是否必须参数说明errnoint是错误码err......
  • Ubuntu下安装Python虚拟环境
    安装和配置安装包管理神器pipsudoaptinstallpython-pip升级pipsudopipinstall--upgradepip安装virtualenv,virtualenvwrappersudopipinstallvirtualenvsudopipinstallvirtualenvwrapper配置virtualenvwrapper#默认的virtualenvwrapper安装在/u......
  • Python虚拟环境conda的安装使用
    文章目录conda虚拟环境的详细步骤和注意事项:**安装Conda****创建Conda虚拟环境****激活Conda虚拟环境****安装Python包****管理Conda环境****其他优势与特性**相较于`venv`,使用`conda`管理虚拟环境有以下优势:**性能****资源占用****其他性能与资源相关因素****结论**......
  • 2种包管理工具:pip和pipenv
    一、pippip 是Python的包安装器,它用于安装和管理Python包,它通过requirements.txt文件来管理项目所依赖的包1、生成requirements.txt文件:pipfreeze>requirements.txt2、安装requirements.txt依赖:pipinstall-rrequirements.txt3、激活虚拟环境:sourcemyenv/bin/activ......