How to have python3.6 alongside python3.7 windows 10 - python-3.x

I'm trying to install tensorflow onto a Windows PC with Python3.7. However, I'm had errors. From what I can gather this is happening because tensorflow doesn't yet support Python3.7. As a workaround I want to install Python3.6 alongside 3.7 and then install tensorflow to that version. However, I'm new to Windows and
when I call for Python in the terminal I now have
C:\Users\antoi>python
Python 3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 13:35:33) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
How can I have 3.7 as well as we would have been able on Ubuntu ?

You can just install python 3.6, add it's binary path to the system path and call it as python3.6 (actually the same way it works in ubuntu). You can also explicitly call it with its full path: C:\Program Files\Python3.6\bin\python3.6.exe -m pip install tensorflow.

Related

Has anybody figured out how to use pywin32 in a virtual environment?

People have been trying for years to get pywin32 to work inside a virtual environment, and it seems nobody has succeeded yet. At least, all the unanswered questions about how to do it are swamping the few questions that have received answers. I need to have my Python script use COM to communicate with an ActiveX program, and so I need win32com.client.Dispatch(), and so I need pywin32. I've read that pypiwin32 is the currently favored module, but it depends on pywin32.
I can load pywin32 into my registered copy of Python with no trouble, but I want to be able to use a virtual environment based on the 32-bit version of Python 3.8.
So how do I do it? If I need a 64-bit version of Python, I can switch, but I'd rather not.
Here is what happens when I tried it using a venv based on 64-bit Python 3.8 on my Win10 box:
(venv) C:\misc\venv_test\venv\Scripts>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
(venv) C:\misc\venv_test\venv\Scripts>pip install pywin32
Collecting pywin32
Could not find a version that satisfies the requirement pywin32 (from versions: )
No matching distribution found for pywin32
(venv) C:\misc\venv_test\venv\Scripts>pip install c:\misc\pywin32-227-cp38-cp38-win32.whl
pywin32-227-cp38-cp38-win32.whl is not a supported wheel on this platform.
(venv) C:\misc\venv_test\venv\Scripts>pip install c:\misc\pywin32-227-cp38-cp38-win_amd64.whl
pywin32-227-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
And on a venv based on the 32-bit version of Python 3.8:
(venv) T:\Worthington Steel\Scripts Python3\venv\Scripts>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
(venv) T:\Worthington Steel\Scripts Python3\venv\Scripts>pip install pywin32
Collecting pywin32
Could not find a version that satisfies the requirement pywin32 (from versions: )
No matching distribution found for pywin32
(venv) T:\Worthington Steel\Scripts Python3\venv\Scripts>pip install c:\misc\pywin32-227-cp38-cp38-win32.whl
pywin32-227-cp38-cp38-win32.whl is not a supported wheel on this platform.
(venv) T:\Worthington Steel\Scripts Python3\venv\Scripts>pip install c:\misc\pywin32-227-cp38-cp38-win_amd64.whl
pywin32-227-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
(venv) T:\Worthington Steel\Scripts Python3\venv\Scripts>

How do I remove python 3.8 when i have both python 3.7 and 3.8 installed on MacOS?

I have a really messy python installation on my mac, need some help.
I installed python3 with Homebrew and it showed that
python 3.7.8 is already installed and up-to-date
But when I run python3 on my terminal, i see,
Python 3.8.3 (default, May 27 2020, 20:53:40)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
And now i cant install any modules with pip3, it shows,
File "/usr/local/opt/python#3.8/bin/pip3", line 6, in <module>
from pkg_resources import load_entry_point
ModuleNotFoundError: No module named 'pkg_resources'
I would like to remove python 3.8 completely and use 3.7 instead, what should I do?
solution
In the link there is solution about deleting 2.8. I guess deleting python versions does not change version to version. Check that link.

How to install pip3 for a specific python version

I have python3.7 installed but also python3.4. For example:
$ python3
Python 3.4.3 (default, Nov 12 2018, 22:25:49)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
And:
$ python3.7
Python 3.7.0 (default, Jun 28 2018, 00:00:00)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
How can I install packages to python3.7 ? Any pip3 command I use goes to python3.4 and I'm not sure how to install anything for python3.7. Any ideas? Even running something like this doesn't work:
$ python3.7 -m ensurepip --upgrade
/usr/bin/python3.7: No module named ensurepip
Or:
$ sudo python3.7 -m pip install PyMySQL
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
I don't know whether this may be an appropriate solution for you. But this is what I generally follow.
Just install Anaconda in your system and create different environments according to your needs.
For your case create two different environments one for Python 3.4.3 and another for Python 3.7 using the following command
conda create --name py34 python=3.4.3 and
conda create --name py37 python=3.7
//This lines will create two new environments named py34 and py37
You then install libraries according to your needs in the respective environment. Now you can work into each environment without interfering with the libraries of the other environment.
To use anaconda kindly follow Anaconda cheatsheet. You will get everything that you need.
Hope this will help you.
This might help : It addresses the same issue as yours. In short, try
python3.7 -m pip install pip
Here's a reference documentation

MacOS Python 3.7 virtualenv fails?

My system is running MacOS and Homebrew and it recently updated to Python 3.7.
Now, just creating a new virtualenv and trying to use it fails.
FYI, I don't actually need Python 3.7. I didn't upgrade on purpose. I'd prefer the latest stable, supported version, but of course, I want the basics working.
➜ rm -rf ~/.virtualenvs/test
➜ python3 -m venv ~/.virtualenvs/test
➜ vex --path ~/.virtualenvs/test python
zsh: /usr/local/bin/vex: bad interpreter: /usr/local/opt/python/bin/python3.6: no such file or directory
➜ python3
Python 3.7.0 (default, Jun 29 2018, 20:13:13)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
/usr/local/bin/vex file has this as the first line: #!/usr/local/opt/python/bin/python3.6; it's called shebang and it points operating system to the interpreter to run the script. You've uninstalled python3.6 so OS cannot find said interpreter. You need to reinstall vex with python3.7.

getting error 'No module named pip3' in spite of pip3 being present

I'm on ubuntu 14.04. Python 3.4 was present already, I additionally installed python 3.6.
Python 3.6 seemingly runs fine:
...:/usr/bin$ python3.6
Python 3.6.3 (default, Oct 6 2017, 00:00:00)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
pip3 also runs fine, but for python 3.6.4 (as expected):
...:/usr/bin$ pip3 -V
pip 9.0.1 from /usr/local/lib/python3.4/dist-packages (python 3.4)
So I tried running pip3 under python 3.6, but no luck:
...:/usr/bin$ python3.6 -m pip3 -V
/usr/bin/python3.6: No module named pip3
When searching I found a couple of suggestioons aroundthat error message, but they were all about pip3 not working at all, which is not my problem.
What am I getting wrong?

Resources