best way to start shell / work under different Pythons
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Question
My system python, as returned by /usr/bin/env python
is Python 2.7, so for me, by default I get a Python 2.7 env, which is no longer what I want 😉
Probably a non poetry question: but how would I change my system, config so that /usr/bin/env python
return which python3.7
?
In any case, I still need to support 2.7 and 3.6+ on most of my libraries, so it looks like I can do this by doing the following:
python3.7 `which poetry` shell
poetry install
…for a 3.7 env, and the following for a 2.7 env:
poetry shell
poetry install
Is that the best way or have I missed something? Does this need to be in the docs somewhere or have I just missed them?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Best way to run shell commands from python [duplicate]
I've tried subprocess.check_output , which works, however, this data is not easy to work with, and I don't believe it supports piping commands ......
Read more >How to execute shell commands properly in Python
In this post, we have introduced different ways to execute shell commands in Python. As a general rule, we should avoid using os.system()...
Read more >Python Interpreter: Shell/REPL - TutorialsTeacher
To run the Python Shell, open the command prompt or power shell on Windows and terminal window on mac, write python and press...
Read more >Executing Shell Commands with Python - Stack Abuse
In this article, we will look at the various ways to execute shell commands in Python, and the ideal situation to use each...
Read more >Executing Shell Commands with Python - GeeksforGeeks
This article starts with a basic introduction to Python shell commands and why one should use them. It also describes the three primary...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, true. I guess pyenv is close to what I want, but building everything seems silly. That’s a rant for the pyenv tracker though, so I think I have my answer here 😃
Sounds like pyenv is not a good choice for your use case.
If you require using a specific build of python, then I would create a virtual environment using that interpreter, activate it, which should point
python
to the desired version / build and then run poetry inside it. Poetry will detect that it’s inside a virtual environment and install packages accordingly.