version

How do I tell a Python script to use a particular version

How do I tell a Python script to use a particular version Question: How do I, in the main.py module (presumably), tell Python which interpreter to use? What I mean is: if I want a particular script to use version 3 of Python to interpret the entire program, how do I do that? Bonus: How …

Total answers: 8

Upgrade python in a virtualenv

Upgrade python in a virtualenv Question: Is there a way to upgrade the version of python used in a virtualenv (e.g. if a bugfix release comes out)? I could pip freeze –local > requirements.txt, then remove the directory and pip install -r requirements.txt, but this requires a lot of reinstallation of large libraries, for instance, …

Total answers: 13

Which version of Python do I have installed?

Which version of Python do I have installed? Question: I have to run a Python script on a Windows server. How can I know which version of Python I have, and does it even really matter? I was thinking of updating to the latest version of Python. Asked By: Ali_IT || Source Answers: python -V …

Total answers: 27

How to: Macports select python

How to: Macports select python Question: When I enter: port select –list python This is the result: Available versions for python: none python25 (active) python25-apple python26-apple python27 python27-apple I thought when I use python I would be using version 2.5. Instead when I enter “python”, version 2.7 seems to be active. How do I change …

Total answers: 5

Automatic version number both in setup.py (setuptools) AND source code?

Automatic version number both in setup.py (setuptools) AND source code? Question: SITUATION: I have a python library, which is controlled by git, and bundled with distutils/setuptools. And I want to automatically generate version number based on git tags, both for setup.py sdist and alike commands, and for the library itself. For the first task I …

Total answers: 7

Install particular version with easy_install

Install particular version with easy_install Question: I’m trying to install lxml. I’ve had a look at the website, and version 2.2.8 looked reasonable to me but when I did easy_install lxml, it installed version 2.3.beta1 which is not really what I want I presume. What is the best way to fix this and how can …

Total answers: 3

Change default Python version from 2.4 to 2.6

Change default Python version from 2.4 to 2.6 Question: I’m wanting to use some newer software that requires Python 2.6, and we currently have both 2.4 and 2.6 installed on our dedicated CentOS server, which looks like this: $ which python /usr/local/bin/python $ which python2.6 /usr/bin/python2.6 $ which python2.4 /usr/local/bin/python2.4 $ ls -l /usr/local/bin/py* -rwxr-xr-x …

Total answers: 6

How do I check which version of NumPy I'm using?

How do I check which version of NumPy I'm using? Question: How can I check which version of NumPy I’m using? Asked By: larus || Source Answers: >> import numpy >> print numpy.__version__ Answered By: Dominic Rodger import numpy numpy.version.version Answered By: SilentGhost From the command line, you can simply issue: python -c “import numpy; …

Total answers: 17

How do I check which version of Python is running my script?

How do I check which version of Python is running my script? Question: How do I check which version of the Python interpreter is running my script? Asked By: carrier || Source Answers: This information is available in the sys.version string in the sys module: >>> import sys Human readable: >>> print(sys.version) # parentheses necessary …

Total answers: 27

Checking a Python module version at runtime

Checking a Python module version at runtime Question: Many third-party Python modules have an attribute which holds the version information for the module (usually something like module.VERSION or module.__version__), however some do not. Particular examples of such modules are libxslt and libxml2. I need to check that the correct version of these modules are being …

Total answers: 7