Python Forum
can import msvcrt and click on windows but not on Linux - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: can import msvcrt and click on windows but not on Linux (/thread-12011.html)



can import msvcrt and click on windows but not on Linux - sylas - Aug-05-2018

Hi all! I have a double boot 64 bits computer. With Linux I cannot import msvcrt or click. What to do on Linux ? I tried "sudo apt-get install msvcrt" without success. Same for "click".


RE: can import msvcrt and click on windows but not on Linux - Gribouillis - Aug-05-2018

One doesn't use msvcrt in linux. You need to use linux tools.


RE: can import msvcrt and click on windows but not on Linux - snippsat - Aug-05-2018

msvcrt is Windows only,can use getch which is a rewrite for Linux.
Click is normal install via pip.
# Newest pip is now 18.0 | pip install --upgrade pip
mint@mint ~ $ pip -V
pip 18.0 from /home/mint/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pip (python 3.7)

mint@mint ~ $ pip install getch
Collecting getch
  Downloading .....
Installing collected packages: getch
  Running setup.py install for getch ... done
Successfully installed getch-1.0

# Test
mint@mint ~ $ ptpython
>>> import getch
>>> 
>>> char = getch.getch()
>>> char
'f'
mint@mint ~ $ pip install click
Collecting click
............... 
Successfully installed docopt-0.6.2 jedi-0.12.1 parso-0.3.1 prompt-toolkit-1.0.15 ptpython-0.41 pygments-2.2.0 six-1.11.0 wcwidth-0.1.7

# Test
mint@mint ~ $ ptpython
>>> import click

>>> click.__version__
'6.7'
>>> exit()



RE: can import msvcrt and click on windows but not on Linux - sylas - Aug-06-2018

Thanks for your help. I must tell you, since I did not succeed to make python3 the default language, the default language is 2.7(in Linux), so with click I installed with "sudo pip install click" I got : "successfully installed click 6.7" but it works only if I am on python2.7.
Another disagreeable thing I must tell you is that I loose my connexion to python forum each time I change my OS(from windows to Linux, and vice-versa). And logging once again is really tiring.


RE: can import msvcrt and click on windows but not on Linux - Gribouillis - Aug-06-2018

Use sudo pip3 install click to install it for python 3.