Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I'm a Python developer and just wanted to add to the question about Python packages.
- It is always best to install Python packages through pip into a virtualenv and keep the system packages as clean as possible. If you are using Python 3.3+ you can use the built in venv package to setup your virtualenv. This works just like virtualenv but doesn't need a 3rd party package to be installed. If the package does need to be installed system wide such as "uwsgi/gunicorn/salt/ansible/etc..." for "web hosting/management/etc..." you would want to use pip outside of the virtualenv.
- This will allow you to install a spastic version of the package and update it when you want to not when the package maintainer does and update. You can also use pip to install a package directly from a "website/github/local folder/etc...". If your system also needs to have multiple versions of Python 3 and Python 2.7 you can have a pip for all of them on one system without the risk of stepping on one another "pip-2.7/pip-3.4/pip-3.5/etc.." then when you need a specific version of Python in your script/application you would use the shebang to declare the version at the top of your script/application file.
- Please find below some examples and links to documentation.
- venv documentation:
- https://docs.python.org/3/library/venv.html"
- pip documentation:
- https://pip.pypa.io/en/stable/
- pip specific version install:
- pip install django==1.8
- pip install from github repo:
- pip install -e git+https://github.com/mycroftai/adapt#egg=adapt-parser
- pip install from sourceforge:
- pip install -Iv http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.2/MySQL-python-1.2.2.tar.gz/download
- pip install from folder:
- pip install -e /path/to/my/package/
- pip install only for the current user:
- pip install --user django
- pip update package:
- pip install -U django
- pip install --upgrade django
- pip install packages in bulk:
- - You will need a text file with each package on its own line like the example below
- requirements.txt file:
- Django
- Fabric>=1.2.0
- Jinja2<=2.5.5
- PyYAML==3.09
- - Once this file has been created you will run the following command
- - pip install -r requirements.txt
- - You can also update with the same file by running the following command
- - pip install --upgrade -r requirements.txt
- Please feel free to reach out to me through email or IRC if you have any questions or if I was unclear on anything. I'm also normally in the "freebsd/freebsd-python/django/django-channels" IRC chat rooms under the name "The-Kid".
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement