Issue
I have Python 3.8 (32-bit) in my computer, I use Pycharm and also jupyter notebook. I need to install Python 3.6 (64-bit) because I need to work with tensorflow and it only works with Python 3.6(64-bit)
Can I have two versions of python together? And How can change and work with two python versions in pycharm and jupyter?
Solution
The preferred way to use python virtual environments now is venv
.
You can install any number of python versions on your windows, though please also install the py launcher that it comes with. This makes it easy to launch whichever python version you want through the commandline, with no need to rely on PATH nonsense.
If you've the py
launcher you can simply launch your desired python version using-
py -3.6-64
The above will launch the 64 bit version of python 3.6 (if installed).
Now, you'll also want to use a virtual env and point pycharm to the venv. To make a venv
, go to your project directory (preferably) and do-
> py -3.6-64 -m venv name_of_venv
This will make a venv named of name_of_venv
in your project directory and the python version will be 3.6 64 bit.
Now whenever you need to do any python commands, you no longer need to do py -version
, you can just do python
and even use pip
- BUT before that, you need to activate the venv
> & '.\name_of_venv\Scripts\Activate.ps1'
Now you can do normal python operations as long within this venv and it'll all target 3.6 64 bit (or any other version you choose to build the venv
with).
To deactivate (though you don't really have to) - you can just type deactivate
in the terminal.
Pycharm can be configured with this venv
as simply as just pointing to it. You simply have to go to Add python interpreter and choose Virtualenv Environment
Answered By - Chase
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.