pyenv

Python虚拟环境详细教程,一篇带你入坑

笑着哭i 提交于 2020-07-24 06:24:49
Python 之所以强大,除了语言本身的特性外,更重要的是拥有无所不及的第三方库。强大的软件库,让开发者将精力集中在业务上,而避免重复造轮子的浪费。但众多的软件库,形成了复杂的依赖关系。今天我们就来了解下 Python 虚拟环境. 一些概念 Python 虚拟环境,涉及到很多概念和工具,会对使用造成困扰和障碍,所以我们先了解一些概念和与之相关的工具 python 版本 Python 版本指的是 Python 解析器本身的版本。由于 Python3 不能与 Python2 兼容,而且两大阵营之争持续了很长时间,导致一些软件库需要设配两种版本的 Python,同时开发者可能需要在一个环境中,部署不同版本的 Python,对开发和维护造成了麻烦。因此出现了版本管理器 Pyenv,类似于 nodejs 的 nvm,可以创建出相互隔离的 Python 环境,并且可以方便的切换环境中的 Python 版本,但和 Python 虚拟环境关系不大 python 包库 包库或者叫软件源是 Python 第三方软件的库的集合,或者市场,可以发布、下载和管理软件包,其中 pypi (Python Package Index) https://pypi.org/ 是官方指定的软件包库,基于其上的 pip 工具就是从这里查找、下载安装软件包的。为了提高下载速度,世界上有很多 Pypi 的镜像服务器

How can I make homebrew's python and pyenv live together?

雨燕双飞 提交于 2020-06-23 23:54:16
问题 After switching to python 3.4.3 from 2.7.9 (which was quite simple), I often wish to test some of my scripts with python 2.7.9 before sharing them with colleagues. I am using a OSX yosemite platform with everything compiled from homebrew. The situation was quite ugly (setting PATH es and PYTHONPATH at each step) - until I discovered pyenv which does this very easily and is easily installed using homebrew. So far, so good. However, now that I am using this version of python, it does not

How can I make homebrew's python and pyenv live together?

让人想犯罪 __ 提交于 2020-06-23 23:48:09
问题 After switching to python 3.4.3 from 2.7.9 (which was quite simple), I often wish to test some of my scripts with python 2.7.9 before sharing them with colleagues. I am using a OSX yosemite platform with everything compiled from homebrew. The situation was quite ugly (setting PATH es and PYTHONPATH at each step) - until I discovered pyenv which does this very easily and is easily installed using homebrew. So far, so good. However, now that I am using this version of python, it does not

Failed to activate virtualenv with pyenv

放肆的年华 提交于 2020-06-09 08:39:22
问题 I run: pyenv activate new_app And I get: Failed to activate virtualenv. Perhaps pyenv-virtualenv has not been loaded into your shell properly. Please restart current shell and try again. I am trying to follow this tutorial: https://tutorials.technology/tutorials/59-Start-a-flask-project-from-zero-building-api-rest.html Other info: bash-3.2$ python --version Python 3.6.0 bash-3.2$ pyenv version 3.6.0 (set by /Users/me/Projects/flask_api/.python-version) bash-3.2$ pwd /Users/me/Projects/flask

Can't run IDLE with pyenv installation: `Python may not be configured for Tk` `ModuleNotFoundError: No module named _tkinter'

北战南征 提交于 2020-06-09 05:37:05
问题 I recently spent couple hours making tkinter and IDLE work on my pyenv Python installation (macOS). Why you are here? You manage Python versions with pyenv on macOS and ( You want IDLE - the development environment for Python - work on your macOS or you want tkinter module work ) What's wrong? You get one of the following errors: Python may not be configured for Tk on import tkinter import _tkinter # If this fails your Python may not be configured for Tk RuntimeError: tk.h version (8.6) doesn

pyenv: failed to activate virtualenv - settings not read from .profile at login

痞子三分冷 提交于 2020-05-17 07:03:47
问题 This is a known topic, almost similar to this one. However - why am I having the pyenv settings passed in ok from .profile at login only up to the virtualenv string. export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" fi eval "$(pyenv virtualenv-init -)" After login, the above portion is read (pyenv is active in terminal) but not virtualenv. Manual activation of the venv produces the well-known error message.

pyenv giving shopt command not found error on macos

匆匆过客 提交于 2020-05-15 05:41:47
问题 I have been using pyenv for managing python versions and virtual environments on my mac for some time now. Recently I reinstalled pyenv and since then on every pyenv command I try to run, I get the following error /usr/local/bin/pyenv:94: command not found: shopt My default shell is the latest MacOS 's default shell i.e. zsh . On searching for the fix, I found out it has something to do with bash interfering with the zsh . My default shell is zsh in settings, the contents of ~/.bash_profile ,

centos下安装opencv

会有一股神秘感。 提交于 2020-05-08 09:28:42
根据项目需要,安装opencv并提供给开发使用, 并且使用opencv提供python3的API接口 。虽然不知道是个啥,还是简单了解下。 ###opencv是什么? OpenCV的全称是Open Source Computer Vision Library,是一个跨平台的计算机视觉库。OpenCV是由英特尔公司发起并参与开发,以BSD许可证授权发行,可以在商业和研究领域中免费使用。OpenCV可用于开发实时的图像处理、计算机视觉以及模式识别程序。该程序库也可以使用英特尔公司的IPP(收费库)进行加速处理。 环境信息: opencv-3.4.4 //3.x版本以上建议使用7系列来安装,省掉超多升级步骤 opencv_contrib-3.4.4 //opencv3以后 SIFT 和 SURF 之类的属性被移到了 contrib 中 centos7 gcc 4.8.x cmake 2.8.x pyenv //shell脚本编写的python版本管理工具 pyenv-virtualenv //虚拟环境 python 3.x //使用opencv提供的python3的API接口 ###一、下载源码包 opencv https://github.com/opencv/opencv opencv_contrib https://github.com/opencv/opencv_contrib

python版本管理(python环境隔离)

瘦欲@ 提交于 2020-05-06 03:36:21
这将是一篇比较短的文章。 我发文向来注重文章质量,营养不够的宁可不发,但是我相信很多人需要这篇文章。 之所以要去搞清楚这个问题,是我在把 vscode 的 inspector 设置为 pipenv 生成的虚拟环境是遇到了问题。2018-2月 vscode 添加了对 pipenv 的支持,检测到 Pipfile 以后,会将环境自动切换到当前项目的虚拟环境。但是我的咋就不行呢!我就开始折腾。这是一个比较漫长相信你们都不想经历的过程。希望你们搜到的第一篇文章就是这篇。相关关键字如下: vscode 对 pipenv 的支持, vscode 找不到 pipenv 创建的虚拟环境, vscode pipenv, pipenv vscode ...等等 希望能给你带来更多营养,我多说点 不知不觉,上面的内容可能要占本文一半以上了。。。 pyenv 和 pipenv 应该是目前主流的 python 版本控制和虚拟环境的工具了,下面内容都基于这两个。 从 PATH 开始。当你要执行终端命令的时候,这个命令是从哪来呢,有个环境变量 PATH 企图hold住这个问题,大部分人打印一下 PATH (echo $PATH) 应该都会发现这样一部分 /usr/local/bin:/usr/bin:/bin 。执行命令时查找循序由左到右,/usr/local/bin 里没找到去 /usr/bin 里找

Python 虚拟环境 pyenv、venv(pyvenv)、virtualenv之间的区别

感情迁移 提交于 2020-04-27 19:21:35
请参考连接 https://blog.zengrong.net/post/2167.html https://blog.csdn.net/lanonjj/article/details/51050212 为避免链接失效,把原文做了复制黏贴 另外在python3.6中,虚拟应该用如下命令创建 python3 - m venv / path / to / new / virtual / environment 直接用pyvenv / path / to / new / virtual / environment 创建也能成功,但是会有一个warning,具体解释可以参考这个文章https://docs.python.org/3/library/venv.html yy1s@linux-9qk9:~> pyvenv monitor2 WARNING: the pyenv script is deprecated in favour of `python3.6 -m venv` --------------------------------------------------------------------------------------------------------------------------------------------------------------