setup pyyaml with pyenv on mac os x; file not found: python.exe

  • Last Update :
  • Techknowledgy :

I ran into the same issue using pyenv. The dirty way I got it to install was using

CC = /path/to / virtualenv_dir / bin / python2 .7 / path / to / virtualenv_dir / bin / pip install pyyaml

If you're using pyenv you can also use

CC = $(which python) pip install pyyaml

You can fix it yourself:

$
export p = /Users/andrei / .pyenv / versions / 2.7 .6
$ sed - i - e "s#python.exe#${p}/bin/python2.7#g"
"$p/lib/python2.7/_sysconfigdata.py"

Suggestion : 2

The command pyenv install --list can be used to fetch a list of all versions of python which are available to be installed with pyenv.,Once the install completes, we can check which versions of python are now available for use with the pyenv versions command.,While it's possible to modify this Pipfile directly, it's better practice to just allow pipenv to make those changes on our behalf. So let's go ahead and install a commonly used library, boto3 for use in this new project. We can install it with the command pipenv install boto3,The output from command above can be extremely long though! Since we're using Amazon Linux 2 for examples, we have grep already installed, which will allow us to filter out everything that isn't 3.7.

$ python--version
Python 2.7 .6
xcode - select--install
/usr/bin / ruby - e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew install openssl readline sqlite3 xz zlib

Suggestion : 3

Last updated: Apr 18, 2022

Copied!#๐Ÿ‘‡๏ธ in a virtual environment or using Python 2
pip install pyyaml

#๐Ÿ‘‡๏ธ
for python 3(could also be pip3 .10 depending on your version)
pip3 install pyyaml

#๐Ÿ‘‡๏ธ
if you get permissions error
sudo pip3 install pyyaml

#๐Ÿ‘‡๏ธ
if you don 't have pip in your PATH environment variable
python - m pip install pyyaml

#๐Ÿ‘‡๏ธ
for python 3(could also be pip3 .10 depending on your version)
python3 - m pip install pyyaml

#๐Ÿ‘‡๏ธ
for Anaconda
conda install - c conda - forge pyyaml
Copied!
   import yaml

print(yaml.load(""
         " -
         Hesperiidae -
         Papilionidae -
         Apatelodidae -
         Epiplemidae ""
         ", Loader=yaml.Loader)
      )
Copied!python--version
Copied!pip3 .10 install pyyaml

#๐Ÿ‘‡๏ธ
if you get permissions error use pip3(NOT pip3.X)
sudo pip3 install pyyaml
Copied!#๐Ÿ‘‡๏ธ make sure to use your version of Python, e.g.3.10
python3 - m pip install pyyaml
Copied!#๐Ÿ‘‡๏ธ check
if you have pyyaml installed
pip3 show pyyaml

#๐Ÿ‘‡๏ธ
if you don 't have pip setup in PATH
python3 - m pip show pyyaml

Suggestion : 4

The AWS Elastic Beanstalk Command Line Interface (EB CLI). This is used to initialize your application with the files necessary for deploying with Elastic Beanstalk., The AWS Elastic Beanstalk Command Line Interface (EB CLI). This is used to initialize your application with the files necessary for deploying with Elastic Beanstalk. ,You can use the Elastic Beanstalk CLI to prepare your Python applications for deployment with Elastic Beanstalk.,For all Python applications that you'll deploy with Elastic Beanstalk, these prerequisites are common:

To follow the procedures in this guide, you will need a command line terminal or shell to run commands. Commands are shown in listings preceded by a prompt symbol ($) and the name of the current directory, when appropriate.

~/eb-project$ this is a command
this is output

The virtualenv package. This is used to create an environment used to develop and test your application, so that the environment can be replicated by Elastic Beanstalk without installing extra packages that aren't needed by your application. Install this package with the following command:

$ pip install virtualenv

Open a command-line window and type:

$ virtualenv / tmp / eb_python_app

Once your virtual environment is ready, start it by running the activate script located in the environment's bin directory. For example, to start the eb_python_app environment created in the previous step, you would type:

$ source / tmp / eb_python_app / bin / activate

To stop using your virtual environment and go back to the systemโ€™s default Python interpreter with all its installed libraries, run the deactivate command.

(eb_python_app) $ deactivate

The virtualenv package. This is used to create an environment used to develop and test your application, so that the environment can be replicated by Elastic Beanstalk without installing extra packages that aren't needed by your application. Install this package with the following command:

$ pip install virtualenv

Open a command-line window and type:

$ virtualenv / tmp / eb_python_app

Replace eb_python_app with a name that makes sense for your application (using your application's name is a good idea). The virtualenv command creates a virtual environment for you in the specified directory and prints the results of its actions:

Running virtualenv with interpreter / usr / bin / python
New python executable in /tmp/eb_python_app / bin / python3 .7
Also creating executable in /tmp/eb_python_app / bin / python
Installing setuptools, pip...done.

Once your virtual environment is ready, start it by running the activate script located in the environment's bin directory. For example, to start the eb_python_app environment created in the previous step, you would type:

$ source / tmp / eb_python_app / bin / activate

To stop using your virtual environment and go back to the systemโ€™s default Python interpreter with all its installed libraries, run the deactivate command.

(eb_python_app) $ deactivate

From within your virtual environment, return to the top of your project's directory tree (python_eb_app), and type:

pip freeze > requirements.txt

This command copies the names and versions of the packages that are installed in your virtual environment to requirements.txt, For example, if the PyYAML package, version 3.11 is installed in your virtual environment, the file will contain the line:

PyYAML == 3.11