[TOC] # To setup pynecone on my Mac This experience can also use in Windows & Ubuntu too. ## Install n command and use it to setup NodeJS 12.22 ### Setup NodeJS environment for pynecone first time. (1) Install NodeJS 12.22 environment $ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - $ which npm ``` In this version of npm, you can install "n". And then you can manage many versions of NodeJS easily. ``` $ sudo npm install -g n ``` In the following, we can install by NodeJS 12.22 by n. ``` $ sudo n 12.22 Right now, you are setup NodeJS 12.22 ready for pynecone development. For more information, if you would like to understand more about using n to do environment managment, then the following section is for you. ### Some command example to manage NodeJS by n When your NodeJS development environment get dirty after doing many npm install, you can delete it and create new one again. ```list all NodeJS environment we have, right now``` $ n ls ``` node/8.12.0 node/10.13.0 node/12.0.0 node/12.22.12 node/13.0.0 node/14.0.0 ``` ```Select from the list, So you can go what version you want``` $ sudo n Using keyboard up/down to select node/12.0.0 environment ```Delete some NodeJS environment for specific version``` $ sudo n rm 12.22.12 $ n ls ``` node/8.12.0 node/10.13.0 node/12.0.0 node/13.0.0 node/14.0.0 ``` ```Create new nodejs environment for specific version ``` $ sudo n 12.22 $ n ls ``` node/8.12.0 node/10.13.0 node/12.0.0 node/12.22.12 node/13.0.0 node/14.0.0 ``` ## Setup by pynecone conda Download and install anaconda first. https://www.anaconda.com/products/distribution ``` After installing finished, you need to ensure you have the conda command. We can check it by which command in Ubuntu & Mac ``` $ which conda ``` To create virtual envionment with python 3.11 and its name is pynecoen-311 ``` $ conda create -n pynecone-311 python=3.11 ``` Jump into the virtual environment pynecone-311 ``` $ conda activate pynecone-311 ``` Install pynecone by pip in the pynecone-311 ``` $ pip install pynecone `If you want to leave pynecone-311 environment` $ conda deactivate ### Some command example to use conda Show how many environments you have and where you are staying now. $ conda env list ``` # conda environments: # base * /Users/milochen/opt/anaconda3 mqtt-pynecone-311 /Users/milochen/opt/anaconda3/envs/mqtt-pynecone-311 pynecone-311 /Users/milochen/opt/anaconda3/envs/pynecone-311 ``` $ conda activate pynecone-311 $ conda env list ``` # conda environments: # base /Users/milochen/opt/anaconda3 mqtt-pynecone-311 /Users/milochen/opt/anaconda3/envs/mqtt-pynecone-311 pynecone-311 * /Users/milochen/opt/anaconda3/envs/pynecone-311 ``` Right now, you know how to switch environment. You can leave your pynecone environment. Then delete it and create it again. **Leave** $ conda deactivate **Delete** $ conda remove -n pynecone-311 --all **Create** $ conda create -n pynecone-311 python=3.11 **Enter** $ conda activate pynecone-311 **Setup pynecone** $ pip install pynecone **Create pynecone project and run it** $ mkdir my_app_name $ cd my_app_name $ pc init $ pc run