So I have a virtualenv folder called venv for my python project.
I can run:
venv/bin/pip install -r requirements.txt
Which installs all requirements I need for the project except one, M2Crypto. The only way to install it is through apt-get:
apt-get install python-m2crypto
How can I then add this package installed through apt to venv folder?
Similar to your system's Python installation, the packages are stored inside lib/python2. */site-packages/ directory.
As long as your virtual environment is activated pip will install packages into that specific environment and you'll be able to import and use packages in your Python application.
virtualenvs folder in the home directory. You can either source the virtualenvwrapper commands to run from the terminal or add the virtualenvwrapper commands to the . bashrc . Now the commands will be accessible in the current terminal by pressing the Tab key.
--system-site-packages
gives access to the global site-packages modules to the virtual environment.
you could do:
$ sudo apt-get install python-m2crypto $ virtualenv env --system-site-packages
... and you would then have access to m2crypto
(along with all other system-wide installed packages) inside your virtualenv.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With