![]() ![]() ![]() You’re going to make mistakes when you first start with Python, and you’re going to want to try the latest and greatest tools (like IPython). It’s a good language to have in your arsenal for when you quickly need to write a web scraper to quick app prototype (although Go Lang is also quite popular for the latter task as well). It’s fast to write, easy to read, and extremely flexible. manage.Python is a pretty great programming language. This worked for me on 5 virtual environments with Django installed.īTW, if. Binary libraries may or may not need to be reinstalled to function properly. Rm -r lib/python2.7/site-packages/setuptools-*.dist-infoįinally, re-create your virtual environment: virtualenv īy doing so, old Python core files and standard libraries (plus setuptools and pip) are removed, while the custom libraries installed in site-packages are preserved and working, as soon as they are in pure Python. Rm -r lib/python2.7/site-packages/setuptools Rm -r lib/python2.7/site-packages/pip-*.dist-info Rm lib/python2.7/site-packages/easy_install.* Run the following commands ( is path of your virtual environment): cd If you're using Homebrew Python on OS X, first deactivate all virtualenv, then upgrade Python: brew update & brew upgrade python Notice: Currently, this is for Python 2.7.x only. Side effect: it also fixes the Symbol not found: _SSLv2_method exception when you do import ssl in a virtual environment after upgrading Python to v2.7.8. The following method is more convenient and robust. Updated: I changed the answer 5 months after I originally answered. If anything goes wrong, you can still create a new virtualenv and install the old dependencies in it ( pip install -r requirements.txt). Before you try to make modifications to the old virtualenv, you should save the dependencies in a requirement file ( pip freeze > requirements.txt) and make a backup of it somewhere else. The following method might not work in newer versions of virtualenv. If you change your virtualenv python version, you will need to install all your packages again for that version (or just link the packages you need into the new version packages folder, i.e: your_env/lib/python_newversion/site-packages) I think you may have some problems if you change from python 2.6 to 2.7 or 2.7 to 3.x but if you just upgrade inside the same version (staying at 2.7 as you want) you shouldn't have any problem, as all the packages are held in the same folders for both python versions (2.7.x and 2.7.y packages are inside your_env/lib/python2.7/). I've tested this approach (the one that create a new virtualenv on top of the old one) and it worked fine for me. If your virtualenv is installed with the same python version of the old one and upgrading your virtualenv package is not an option, you may want to read this in order to install a virtualenv with the python version you want. You just need to know which python is going to use your virtualenv (you will need to see your virtualenv version). Upgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place python3 -m venv -upgrade ENV_DIRĭid you see this? If I haven't misunderstand that answer, you may try to create a new virtualenv on top of the old one. If you happen to be using the venv module that comes with Python 3.3+, it supports an -upgrade option. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |