Reputation: 1969
Just trying to figure out the intended use of Python3.3's implementation of PEP405, which is the venv spec. This is my first dive into Python3, as I've been in Python2 up until now.
Running Linux Mint KDE, which is pretty much a Debian distro, I compiled and installed Python 3.3.2. To try out this fancy new feature, I went to where I wanted to create a venv, and ran python3.3 -m venv testenv
. It properly created the env. What confuses me, according to the spec, there should be a pysetup3 file inside the bin directory, however there isn't such a file. My guess is that it's the equivalent to easy_install.
Since there is no standard install scripts inside the env, I just downloaded and ran the easy_install script, and then ran easy_install pip
to get a pip command for my env.
Is this pysetup3 script an old idea that didn't make the cut? Am I supposed to reinstall easy_install and pip on each new venv?
Upvotes: 5
Views: 1827
Reputation: 6947
Until pip is a part of Python in 3.4, you can create virtual environments that include pip by running this script available in the docs. The script simply extends venv's EnvBuilder class to install setuptools and pip after creation of the environment.
Pip installs to the venv's "local/bin" folder. You'll want to symlink it to the "bin" folder so that it works as expected after running "activate". From the shell, type:
ln -s /path/to/venv/local/bin/pip /path/to/venv/bin/pip
Alternatively, you can add two lines of code to the install_pip() method in the script to do this for you each time:
def install_pip(self, context):
... (default script code) ...
# Add these two lines at the end:
pip_path = os.path.join(context.env_dir, 'local', 'bin', 'pip')
self.symlink_or_copy(pip_path, os.path.join(context.bin_path, 'pip'))
Upvotes: 2
Reputation: 1969
Thanks to Jim Garrison for pointing me in the direction. It seems PEP453 will solve the issue of what seems to be missing in new environments using venv
. PEP453 states that pip
will be available by default in Python installations, including the explicitly referenced venv
. PEP453 is slated to be included in Python 3.4. I guess for now in Python 3.3, we'll have to manually install setuptools
and pip
, or continue to use virtualenv
.
No idea what pysetup3
is from PEP405, but I guess not everything has to be to spec. :)
Upvotes: 2