Reputation: 6014
How to package Python itself into virtualenv
? Is this even possible?
I'm trying to run python on a machine which it is not installed on, and I thought virtualenv
made this possible. It activates, but can't run any Python.
Upvotes: 0
Views: 72
Reputation: 21926
virtualenv
makes it convenient to use multiple python versions in different projects on the same machine, and isolate the pip install
libraries installed by each project. It doesn’t install or manage the overall python environment. Python must be installed on the machine before you can install or configure the virtualenv
tool itself or switch into a virtual environment.
Side note, consider using virtualenvwrapper
— great helper for virtualenv
.
Upvotes: 1
Reputation: 355
You haven't specified the Operating System you are using.
In case you're using Windows, you don't use virtualenv for this. Instead you:
import site
in the python37._pth
file (only if you want to add additional packages)Lib\site-packages
(you need to create that directory first, of course)Such a python installation is configured in such a way that it can be moved and run from any location.
You only have to ensure the Microsoft C Runtime is installed on the system (but it almost always already is). See the documentation note:
Note The embedded distribution does not include the Microsoft C Runtime and it is the responsibility of the application installer to provide this. The runtime may have already been installed on a user’s system previously or automatically via Windows Update, and can be detected by finding ucrtbase.dll in the system directory.
Upvotes: 0
Reputation: 6014
When setting up the virtualenv
(this can also be done if it already set up) simply do:
python -m virtualenv -p python env
And Python will be added to the virtualenv
, and will become the default python of it.
The version of Python can also be passed, as python
uses the first version found in the PATH.
Upvotes: 1
Reputation: 623
You might need to install python in some location you have the permissions to do so.
Upvotes: -1