I installed pyenv-win on my windows machine. It works fine in the command line. I can install python versions, set them as global etc. But My VS Code doesn't see them. It only sees one python interpreter I installed a long time ago when I wasn't using pyenv yet.
VScode:
pyenv:
C:\Users\jbron\cmder
λ pyenv versions
3.7.0
* 3.8.0 (set by C:\Users\jbron\.pyenv\pyenv-win\version)
Why is it not finding my pyenv interpreters? I don't have problems like that on my Linux machines
It is recommended that you try the following:
Please check whether the Python environment variable contains your installed Python path:
Please reopen VSCode after installation:
Update:
The environment variable path of "pyenv" I use is: (Under this path, we can find Python 3.6.7 downloaded by pyenv)
We can see the storage location where it downloaded Python 3.6.7:
C:\Users\...\.pyenv\pyenv-win\install_cache\python-3.6.7-amd64-webinstall.exe
Double-click to install:
Related
I am currently running python 3.9.13 on my mac. I wanted to update my version to 3.10.10
I tried running
brew install python
However it says that "python 3.10.10 is already installed"!
When i run
python3 --version
in the terminal it says that i am still on "python 3.9.13"
So my question is, how do i change the python version from 3.9.13 to 3.10.10? I already deleted python 3.9 from my applications and python 3.10 is the only one that is still there.
I also tried to install python 3.10.10 from the website and installing it. However it does not work. Python 3.10.10 is being installed successfully but the version is still the same when i check it.
Python 3.10.10 is already installed along with Python 3.9.13. Your path is probably pointing to 3.9.13 and that's why you're getting that Python version.
Try modifying your path variable to point to brew's Python installation, or (better yet) make use of a virtual environment.
a) Telling what Python version your PATH variable is pointing to:
$ which python
Will tell you what's the actual executable's path. That way, you are going to see exactly where you main python resides.
b) If you want to create a virtual environment with brew's python try something like:
$ /usr/local/Cellar/python#3.10/3.10.1/bin/python3 -m venv py310
$ source venv/bin/activate
$ python
> # you should be inside a 3.10.1 envornamente
> CTRL+D
$ pip install requests
you can use pyenv to work with multiple python environments
things to do:
install pyenv : brew install pyenv
install particular python: pyenv install 3.10.10
set python3.10.10 to gloabal python env: pyenv global 3.10.10
and can start using python 3.10.10 version
Just delete the current python installation on your device and download the version you want from the offical website. That is the easiest way and the most suitable one for a beginner.
Now this is not a duplicate question:
I installed (upgraded Python) using the Windows installer.
It gave me the "upgrade" option. So I did.
But herein lies the problem.. It has seemingly upgraded the versions inside my virtual environments created with VENV. When I run python -V inside the activated environment it shows version 3.10.8 when it should be 3.10.4 (the version I upgraded from)..
Is this normal behaviour? See installers below:
https://docs.python.org/3/using/windows.html#virtual-environments
which pip3:
/Library/Frameworks/Python.framework/Versions/3.8/bin/pip3
python version in notebook:
import platform
print(platform.python_version())
3.9.2
I want my jupyter notebook to run on python 3.8.
NOTE: I'm intentionally avoiding conda for this exercise.
Jupyter is installed into a particular Python environment like any other Python module. If Jupyter is running under Python 3.9, then you're running the version of it that was installed by the pip in Python 3.9. It might be installed in the base 3.9 implementation, or it could be installed in a virtual environment that is based on Python 3.9.
If you want a Jupyter that is running under Python 3.8, then you need to run the version of it that is installed under Python 3.8 or a virtual environment based on 3.8. If no such version exists, then you need to install it using Python 3.8 pip. Once installed, you need to run that version of it. You can always do that by specifying the full path to the appropriate jupyter binary. But that is, of course, not ideal...
Which version you get when you run just jupyter is a function of your PATH and/or any Python package manager you might be running. I use pyenv, and that tool will set it up so that for the Python version I've chosen to be the current global version, that version's (or virtual environment's) bin directory becomes the first Python bin directory in my PATH. So if I type jupyter, I always run the version that is installed in what pyenv has made the current global Python environment.
I'm attempting to use pipenv and pyenv to create a virtual environment using python 3.9.0 for a project, but am not able to get pipenv to recognize the version of python 3.9.0 installed by pyenv. Oddly, using pyenv python 3.8.6 works just as expected, and I'm specifying the specific python I want pipenv to use, similar to this answer.
I'm running Catalina 10.15.7 and had a coworker reproduce this exact same behavior on his machine.
Both Pipenv and pyenv have been installed via Homebrew. I have since tried uninstalling homebrew Pipenv and reinstalling with pip, with the same results.
To Reproduce
I successfully ran pyenv install 3.9.0, and when I run pyenv versions, I see:
system
3.8.6
3.9.0
Just as I'd expect.
Inside my working directory, I run pyenv local 3.9.0 to switch my local version of python, followed by pyenv version, which returns returns:
3.9.0 (set by /Users/my-name/myproject)
indicating that the local version was set.
To double check, running pyenv which python returns:
/Users/my-name/.pyenv/versions/3.9.0/bin/python
Now, if I run pipenv install --python 3.9.0 I get the following:
This already is suspect, since 3.9.0 is my local version already. If I respond with y, I get:
Which seems odd, as when I run python, I get to python 3.9.0, so clearly it is on my path. A Pipfile is not created for me, and I don't get a pipenv virtual environment.
Now, if instead I run pipenv install --python $PIPENV_PYTHON, which should in theory use the version of python on my path (which, again, should be 3.9.0), I get this:
Notice how it says "using /users/..../python (3.9.0) to create virtualenv", which is correct, however the next line down says "created virtual environment CPYTHON3.8.6...".
Now, if I repeat the above steps using python 3.8.6, everything works fine.
Additionally, if I specify pipenv --python ~/.pyenv/versions/3.9.0/bin/python3.9, that also seems to work fine -- so for some reason it's not respecting the version, but it is respecting the binary.
The same is true if I run pipenv install --python $(pyenv which python), since it's effectively the same thing as the above command.
For reference my environment vars:
PIP_PYTHON_PATH=/usr/local/Cellar/pipenv/2020.11.15/libexec/bin/python <- perhaps this is a problem?
PIPENV_ACTIVE=1
PIPENV_PYTHON=/Users/myname/.pyenv/shims/python
PYENV_ROOT=/Users/myname/.pyenv
And my $PATH starts with PATH=/Users/my-name/.pyenv/shims:
I do happen to have python 3.8 and python 3.9 installed via homebrew as well, however I'm not trying to use these, and since my path leads off with the shims, I feel like this should not be a problem. Running which python3 and which python both point to the "shims" folder.
Summary
Pipenv is not respecting my pyenv shims, despite the fact that my PYENV_ROOT and my PATH are set correctly. Running pipenv install --python $(pyenv which python) works, specifying a python version does not.
Is this a problem with pipenv, or pyenv, or something that I'm doing?
Per the pipenv docs:
Pipenv by default uses the Python it is installed against to create
the virtualenv. You can set the --python option to $(pyenv which python) to use your current pyenv interpreter.
It was probably using your system python versions rather than your shims
I have just installed pyenv following the installation guide pyenv-win, things goes smoothly, but i could not make the pyenv global python as the global interpreter
I have rehashed after installation using pyenv rehash
PS D:\> pyenv versions
3.5.1
3.6.2
3.7.7
* 3.8.2 (set by C:\Users\xxx\.pyenv\pyenv-win\version)
results
> python --version
> 3.8.4
# expected
> 3.8.2
therefore, I am not able to use virtualenv with the pyenv installed python interpreter
virtualenv py382-djangodev --python=3.8.2
The path 3.8.2 (from --python=3.8.2) does not exist
I had the same issue which I finally solved:
1 - Uninstall Python (your current version when you type the command python -V)
2 - Install pyenv-win and add it to the PATH (here are some optional steps to install it via chocolatey, which adds it directly to the PATH)
2.2 - Install chocolatey
2.3 - In an administrator powershell run: choco install pyenv-win
3 - Start menu (windows key) -> Manage application execution aliases -> disable aliases related to python
4 - install the desired python version via pyenv: pyenv install DESIRED VERSION NUMBER
5- run pyenv rehash
6 - set it as global pyenv global DESIRED VERSION NUMBER
7 - you sould see the desired version by running the command python -V
In windows NT, the PATH variable is a combined result of the system and user variables:
The Path is constructed from the system path, which can be viewed in
the System Environment Variables field in the System dialog box. The
User path is appended to the system path
Shims PATH are defined in the user variables, so make sure your host python interpreter path is not defined in your system path
Deinstalling everything connected to python (except pyenv) and using pyenv only worked for me.