How do I install the yaml package for Python?
You could try the search feature in pip,
$ pip search yaml
which looks for packages in PyPI with yaml in the short description. That reveals various packages, including PyYaml, yamltools, and PySyck, among others (Note that PySyck docs recommend using PyYaml, since syck is out of date). Now you know a specific package name, you can install it:
$ pip install pyyaml
If you want to install python yaml system-wide in linux, you can also use a package manager, like aptitude
or yum
:
$ sudo apt-get install python-yaml
$ sudo yum install python-yaml
How to install pyYAML on windows 10
Download the wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyyaml that suits your need (Python version, 32/64 bit).
$ pip3 install PyYAML-3.11-cp35-none-win32.whl
How to install packages from yaml file in Conda
You want the conda-env
command instead, specifically
conda env update -n my_env --file ENV.yaml
Read the conda env update --help
for details.
If you wish to install this in the base env, then you would use
conda env update -n base --file ENV.yaml
Note that the base env isn't technically "global", but rather just the default env as well as where the conda
Python package lives. All envs are isolated unless you are either using the --stack
flag during activation to override the isolation or have - contra recommended practice - manually manipulated PATH
to include an env.
Why isn't yaml package getting installed in conda env?
As @Tzane already mentioned yaml is called pyyaml.
use,
conda install -c anaconda pyyaml
To download pyyaml.
Links to official conda and PyPi mentions of yaml.
How do I install the yaml package for my PyCharm Python project?
I think you're looking for pyyaml
https://pypi.org/project/PyYAML/
No module named yaml (brew broke my python, again)
There are two packages with somewhat unfortunate naming in the Python Package Index.
pip install pyyaml
lets youimport yaml
. This package enables Python to parse YAML files.pip install pyaml
lets youimport pyaml
. This package allows pretty-printing of YAML files from Python, among other things. It requirespyyaml
to be installed.
So the way forward for you is:
- Install
pyyaml
, preferably using pip - Install
pyaml
- Profit
Step 0 would be to run everything from a virtual environment to prevent homebrew from messing with your Python ever again. This option also lets you run multiple versions of Python, not just the one required by homebrew.
Installing python2 pyyaml
Just do a curl for the following to install pip for python2:
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
Then runsudo python2 get-pip.py
You can then use the command pip2 --version
tp check if pip is installed and for the correct version of python.
Related Topics
Python - Using the Multiply Operator to Create Copies of Objects in Lists
Keep Same Dummy Variable in Training and Testing Data
How to Understand the Output of Dis.Dis
Using Psycopg2 with Lambda to Update Redshift (Python)
How to Merge Multiple Lists into One List in Python
How to Implement Linear Interpolation
Class Variables Is Shared Across All Instances in Python
Print List of Lists in Separate Lines
How to Sort a Pandas Dataframe by Index
Better Way to Shuffle Two Numpy Arrays in Unison
Format Strings VS Concatenation
Passing a Data Frame Column and External List to Udf Under Withcolumn