Python Forum
can import msvcrt and click on windows but not on Linux
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can import msvcrt and click on windows but not on Linux
#1
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".
Reply
#2
One doesn't use msvcrt in linux. You need to use linux tools.
Reply
#3
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()
Reply
#4
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.
Reply
#5
Use sudo pip3 install click to install it for python 3.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to compile a Python script for a Windows / Linux executable? netanelst 2 1,279 May-24-2022, 07:02 AM
Last Post: netanelst
  Resources for printing tabledata-Linux and Windows hammer 4 1,390 Apr-25-2022, 12:09 PM
Last Post: hammer
  multiprocessing difference between Linux and Windows direl 2 2,604 Oct-01-2020, 07:10 PM
Last Post: direl
  ImportError: cannot import name 'MidiEvaluator' from 'parser' (Windows 10) spiffspaceman 4 2,631 May-22-2020, 10:16 PM
Last Post: snippsat
  script works in windows but not in linux ovidius80 2 2,689 Apr-29-2020, 02:10 PM
Last Post: ovidius80
  keyboad scanner routine(linux and windows) 1885 0 1,880 Oct-26-2019, 03:34 PM
Last Post: 1885
  Coloured text in the terminal works in Linux but not Windows Flexico 2 2,665 Aug-26-2019, 10:44 PM
Last Post: Flexico
  MSVCRT Help TomJS 6 4,841 Aug-22-2019, 12:55 PM
Last Post: snippsat
  Python files made on linux don't work on windows sylas 2 3,208 Oct-10-2018, 05:34 AM
Last Post: sylas
  msvcrt.getch prints twice inside loop ReallyBigTeeth 5 6,854 Sep-04-2018, 06:54 AM
Last Post: ReallyBigTeeth

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020