Apr-11-2018, 07:44 PM
Hello all, I just started teaching myself python about 3 days ago. The language has been fun to learn. However, I have run into a bit of a problem. When I use textwrangler to write a script and run it from the terminal a traceback pops up:
Traceback (most recent call last):
File "while.py", line 3, in <module>
import random
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/random.py", line 42, in <module>
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ImportError: cannot import name 'log'
The script is very simple in textwrangler:
#!/usr/bin/env python3
import random
num = random.randint(1,10)
print(num)
I have tried using pip (and pip3) install random but then this error comes up:
Collecting random
Could not fetch URL https://pypi.python.org/simple/random/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) - skipping
Could not find a version that satisfies the requirement random (from versions: )
No matching distribution found for random
I have also tried all kinds of other commands using sudo but nothing seems to work. The very strange thing is that when I import random in the python shell idle, the program works and I can print a random number. If you are wondering, my package manager is homebrew and I am new to that as well.
Any help would be greatly appreciated!
Traceback (most recent call last):
File "while.py", line 3, in <module>
import random
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/random.py", line 42, in <module>
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ImportError: cannot import name 'log'
The script is very simple in textwrangler:
#!/usr/bin/env python3
import random
num = random.randint(1,10)
print(num)
I have tried using pip (and pip3) install random but then this error comes up:
Collecting random
Could not fetch URL https://pypi.python.org/simple/random/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) - skipping
Could not find a version that satisfies the requirement random (from versions: )
No matching distribution found for random
I have also tried all kinds of other commands using sudo but nothing seems to work. The very strange thing is that when I import random in the python shell idle, the program works and I can print a random number. If you are wondering, my package manager is homebrew and I am new to that as well.
Any help would be greatly appreciated!