- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这个问题在这里已经有了答案:
Can existing virtualenv be upgraded gracefully?
(5 个回答)
2年前关闭。
我已经使用 python 3.6 创建了一个虚拟环境,然后我进行了系统升级,并且在系统范围内安装了 python 3.7。现在我无法在那个虚拟环境中执行 python 文件,因为它正在搜索 python 3.6。
如何升级 virtualenv python 版本以匹配系统范围的版本或如何降级该特定虚拟环境的 python 版本?
我正在使用manjaro。
最佳答案
编辑 1
做了一些测试,发现了另一种更“优雅”的方式来(至少)更新可执行文件。让我们假设虚拟环境最初是这样创建的virtualenv -p /path/to/my/python2.7 .venv
.可执行文件可以更新为特定的 python 版本,如下所示:virtualenv --clear -p /path/to/my/python3.6 .venv
.请验证 python
.venv/bin/python
中的符号链接(symbolic link)使用 ls -la .venv/bin/python
更新.旧的可执行文件仍将位于 ./venv/bin/
.
注意:您需要安装特定目标版本的python。
见 this link这很好地解释了它。
Virtualenvwrapper comes with some convenient commands for managing your virtualenvs.
To change your Python version:
Deactivate your current environment session.
If you have many packages or libraries installed, it would be a good idea to make a requirements.txt file. Remember to edit version as necessary.
Remove the virtualenv with the wrapper command: rmvirtualenv
- This will remove the virtualenv, but leave your project files.
Make a new virtualenv with the Python version you want.
Example: mkvirtualenv -p python3 env-name
You can specify the Python version with the -p flag and version. If you have a requirements.txt file, you can specify that with -r requirements.txt
Now bind your new virtualenv to your project directory. You can specify the full paths, but it is easier to have your new virtualenv activated and be in your project directory. Then, run the command:
Example: setvirtualenvproject
关于virtualenv - 如何更改已经存在的 virtualenv 的 python 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51915484/
我有一个相对较大的项目,有很多依赖项,我想分发这个项目,但是安装这些依赖项有点痛苦,并且需要很长时间(pip install 需要相当长的时间)。所以我想知道是否有可能将整个 virtualenv 迁
我有一个 heroku 项目,我想与其他人分享。作为the instructions describe ,我使用 virtualenv 来管理环境和依赖项。有没有办法在新机器上从 requiremen
当我被迫更改我的项目目录名称时,我遇到了一个问题。 首先 Virtualenvwrapper 没有看到我的项目,所以我将 WORKON_HOME 的环境变量更改为新的项目目录。然后我可以激活我的环境。
你可以cd到YOUR_ENV/lib/pythonxx/site-packages/看看,但是有什么方便的方法吗? pip freeze 列出所有已安装的软件包,包括系统环境的软件包。 最佳答案 您可
我想使用 tox 在需要额外设置的项目上运行 py.test 除了将包安装到 virtualenv 之外。创建 virtualenv 并安装依赖项后,需要运行一些命令。 具体来说,我说的是使用 nod
背景:我正在 Mac OS High Sierra 上开发 Flaskr Web 项目。 正处于安装 Flask 阶段,我在安装 virtualenv 时遇到了问题: http://flask.poc
我在我的 ubuntu 电脑上制作了我的 virtualenv。我在那里开发了我的项目。 但我需要 move 我的环境,因为它包含所有包。因为目标机器无法通过网络连接到外部。我必须通过 USB mov
我在激活 virtualenv 时遇到问题。我在服务器上工作并使用 SSH 安全外壳。 我的最终目标是激活 virtualenv 并运行最新版本的 tensorflow 命令行如下: jeonguyo
我的 ~/Documents 中有一堆项目.我几乎只在 python 中工作,所以这些基本上都是 python 项目。每一个,例如~/Documents/foo有自己的 virtualenv,~/Do
我有 --no-site-packages 的 virtualenv选项。我在里面使用了scrapy。 Scrapy 通过 import libxml2 使用 libxml2 .如何使用 pip 在
在 virtualenvwrapper 中,有没有一种简单的方法可以列出我的计算机上的所有 virtualenv? (就像 yolk -l 那样列出当前虚拟环境中的所有 python 包?) 澄清:
本页命令行指令 https://github.com/plumi/plumi.app/blob/master/docs/INSTALL.rst 是“虚拟环境”。 即空格后有句号。 我找不到以这种方式在
我们可以创建一个 virtualenv 吗?从现有的 virtualenv 继承已安装的库? 详细说明: 我首先创建一个“引用”virtualenv,并添加库(固定版本): virtualenv re
我正在使用 sphinx记录我的软件。我正在使用 virtualenv用于安装。现在有些包只安装在虚拟环境中,sphinx 看不到。 我的 conf.py 中有此代码: # If extensions
这个问题在这里已经有了答案: Can existing virtualenv be upgraded gracefully? (5 个回答) 2年前关闭。 我已经使用 python 3.6 创建了一个
这看起来应该很简单: tasks: - name: install python packages pip: name=${item} virtualenv=~/buildbot-env wi
我已经看到了一些针对此问题的修复,但没有一个对我有用,但我认为是我的 virtualenvs 损坏了。我刚刚从 12.04 升级到 14.04,现在我所有的金字塔应用程序都不再工作了。 当我运行 ..
假设我有以下设置: mkdir test && cd test virtualenv .venv source .venv/bin/activate pip install django mkdir
我从 Github 帐户克隆了我的 Django 项目,并使用著名的命令 source nameofenv/bin/activate 激活了 virtualenv当我运行 python manage.
不久前我用 uwsgi/nginx 设置了一个 flask 站点,并设置了一个 virtualenv .. 我忘记了我设置的 venv 的名称,我找不到任何方法在当前目录中列出 virtualenv
我是一名优秀的程序员,十分优秀!